src/Entity/SupplierAccountingAccount.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Constants\SupplierAccountingAccountTypeConstants;
  4. use App\Repository\SupplierAccountingAccountRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=SupplierAccountingAccountRepository::class)
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class SupplierAccountingAccount
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private ?int $id null;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Supplier::class, inversedBy="supplierAccountingAccounts")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private ?Supplier $supplier null;
  23.     /**
  24.      * @ORM\Column(type="string", length=20)
  25.      */
  26.     private ?string $accountCode null;
  27.     /**
  28.      * @ORM\Column(type="string", length=50)
  29.      */
  30.     private ?string $type null;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private ?string $description null;
  35.     /**
  36.      * @ORM\Column(type="boolean")
  37.      */
  38.     private ?bool $isMain null;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private ?bool $active null;
  43.     /**
  44.      * @ORM\Column(type="datetime_immutable")
  45.      */
  46.     private ?\DateTimeImmutable $createdAt null;
  47.     /**
  48.      * @ORM\Column(type="datetime_immutable")
  49.      */
  50.     private ?\DateTimeImmutable $updatedAt null;
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getSupplier(): ?Supplier
  56.     {
  57.         return $this->supplier;
  58.     }
  59.     public function setSupplier(?Supplier $supplier): self
  60.     {
  61.         $this->supplier $supplier;
  62.         return $this;
  63.     }
  64.     public function getAccountCode(): ?string
  65.     {
  66.         return $this->accountCode;
  67.     }
  68.     public function setAccountCode(string $accountCode): self
  69.     {
  70.         $this->accountCode $accountCode;
  71.         return $this;
  72.     }
  73.     public function getType(): ?string
  74.     {
  75.         return $this->type;
  76.     }
  77.     public function setType(string $type): self
  78.     {
  79.         if (!SupplierAccountingAccountTypeConstants::isValid($type)) {
  80.             throw new \InvalidArgumentException(sprintf('Invalid type "%s".'$type));
  81.         }
  82.         $this->type $type;
  83.         return $this;
  84.     }
  85.     public function getDescription(): ?string
  86.     {
  87.         return $this->description;
  88.     }
  89.     public function setDescription(?string $description): self
  90.     {
  91.         $this->description $description;
  92.         return $this;
  93.     }
  94.     public function isIsMain(): ?bool
  95.     {
  96.         return $this->isMain;
  97.     }
  98.     public function setIsMain(bool $isMain): self
  99.     {
  100.         $this->isMain $isMain;
  101.         return $this;
  102.     }
  103.     public function isActive(): ?bool
  104.     {
  105.         return $this->active;
  106.     }
  107.     public function setActive(bool $active): self
  108.     {
  109.         $this->active $active;
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeImmutable
  113.     {
  114.         return $this->createdAt;
  115.     }
  116.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  117.     {
  118.         $this->createdAt $createdAt;
  119.         return $this;
  120.     }
  121.     public function getUpdatedAt(): ?\DateTimeImmutable
  122.     {
  123.         return $this->updatedAt;
  124.     }
  125.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  126.     {
  127.         $this->updatedAt $updatedAt;
  128.         return $this;
  129.     }
  130.     /**
  131.      * @ORM\PrePersist
  132.      */
  133.     public function prePersist(): void
  134.     {
  135.         $this->createdAt = new \DateTimeImmutable();
  136.         $this->updatedAt = new \DateTimeImmutable();
  137.     }
  138.     /**
  139.      * @ORM\PreUpdate
  140.      */
  141.     public function preUpdate(): void
  142.     {
  143.         $this->updatedAt = new \DateTimeImmutable();
  144.     }
  145. }