<?phpnamespace App\Entity;use App\Constants\ClientAccountingAccountTypeConstants;use App\Repository\ClientAccountingAccountRepository;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ClientAccountingAccountRepository::class) * @ORM\HasLifecycleCallbacks */class ClientAccountingAccount{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="clientAccountingAccounts") * @ORM\JoinColumn(nullable=false) */ private ?Client $client = null; /** * @ORM\Column(type="string", length=20) */ private ?string $accountCode = null; /** * @ORM\Column(type="string", length=50) */ private ?string $type = null; /** * @ORM\Column(type="string", length=255, nullable=true) */ private ?string $description = null; /** * @ORM\Column(type="boolean") */ private ?bool $isMain = null; /** * @ORM\Column(type="boolean") */ private ?bool $active = null; /** * @ORM\Column(type="datetime_immutable") */ private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="datetime_immutable") */ private ?\DateTimeImmutable $updatedAt = null; public function getId(): ?int { return $this->id; } public function getClient(): ?Client { return $this->client; } public function setClient(?Client $client): self { $this->client = $client; return $this; } public function getAccountCode(): ?string { return $this->accountCode; } public function setAccountCode(string $accountCode): self { $this->accountCode = $accountCode; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { if (!ClientAccountingAccountTypeConstants::isValid($type)) { throw new \InvalidArgumentException(sprintf('Invalid type "%s".', $type)); } $this->type = $type; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function isIsMain(): ?bool { return $this->isMain; } public function setIsMain(bool $isMain): self { $this->isMain = $isMain; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(\DateTimeImmutable $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * @ORM\PrePersist */ public function onPrePersist(): void { $this->createdAt = new \DateTimeImmutable(); $this->updatedAt = new \DateTimeImmutable(); } /** * @ORM\PreUpdate */ public function onPreUpdate(): void { $this->updatedAt = new \DateTimeImmutable(); }}