<?php
namespace App\Entity;
use App\Repository\CompteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CompteRepository::class)]
#[ORM\Table(name: 'tb_comptes')]
#[ORM\HasLifecycleCallbacks]
class Compte
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer", unique: true)]
private ?int $id;
#[ORM\Column(type: 'string', length: 50, nullable: false)]
private ?string $code;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $clientCode;
#[ORM\Column(type: 'boolean', nullable: true)]
private bool $activated;
#[ORM\Column(type: 'boolean', nullable: true)]
private bool $deleted;
#[ORM\Column(type: 'datetime', nullable: true)]
private \DateTimeInterface $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $modifiedAt;
#[ORM\ManyToOne(targetEntity: AppAccount::class, inversedBy: 'comptes')]
private ?AppAccount $appAccount;
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $createdBy;
#[ORM\Column(type: 'string', length: 100, nullable: true)]
private ?string $name;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->deleted = false;
$this->activated = true;
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getClientCode(): ?string
{
return $this->clientCode;
}
public function setClientCode(string $clientCode): self
{
$this->clientCode = $clientCode;
return $this;
}
public function getActivated(): ?bool
{
return $this->activated;
}
public function setActivated(?bool $activated): self
{
$this->activated = $activated;
return $this;
}
public function getDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(?bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getModifiedAt(): ?\DateTimeInterface
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
public function getAppAccount(): ?AppAccount
{
return $this->appAccount;
}
public function setAppAccount(?AppAccount $appAccount): self
{
$this->appAccount = $appAccount;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @ORM\PreUpdate
*/
public function onUpdate() {
$this->modifiedAt = new \DateTime();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
}