src/Entity/SageFamily.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SageFamilyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=SageFamilyRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class SageFamily
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=20)
  21.      */
  22.     private $sageCode;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $name;
  27.     /**
  28.      * @ORM\Column(type="datetime", nullable=true)
  29.      */
  30.     private $syncDate;
  31.     /**
  32.      * @ORM\Column(type="datetime_immutable")
  33.      */
  34.     private $createdAt;
  35.     /**
  36.      * @ORM\Column(type="datetime_immutable")
  37.      */
  38.     private $updatedAt;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=SageSubFamily::class, mappedBy="family", orphanRemoval=true)
  41.      */
  42.     private $sageSubFamilies;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=SageArticle::class, mappedBy="family")
  45.      */
  46.     private $sageArticles;
  47.     public function __construct()
  48.     {
  49.         $this->sageSubFamilies = new ArrayCollection();
  50.         $this->sageArticles = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getSageCode(): ?string
  57.     {
  58.         return $this->sageCode;
  59.     }
  60.     public function setSageCode(string $sageCode): self
  61.     {
  62.         $this->sageCode $sageCode;
  63.         return $this;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName(string $name): self
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     public function getSyncDate(): ?\DateTimeInterface
  75.     {
  76.         return $this->syncDate;
  77.     }
  78.     public function setSyncDate(?\DateTimeInterface $syncDate): self
  79.     {
  80.         $this->syncDate $syncDate;
  81.         return $this;
  82.     }
  83.     public function getCreatedAt(): ?\DateTimeImmutable
  84.     {
  85.         return $this->createdAt;
  86.     }
  87.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  88.     {
  89.         $this->createdAt $createdAt;
  90.         return $this;
  91.     }
  92.     public function getUpdatedAt(): ?\DateTimeImmutable
  93.     {
  94.         return $this->updatedAt;
  95.     }
  96.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  97.     {
  98.         $this->updatedAt $updatedAt;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, SageSubFamily>
  103.      */
  104.     public function getSageSubFamilies(): Collection
  105.     {
  106.         return $this->sageSubFamilies;
  107.     }
  108.     public function addSageSubFamily(SageSubFamily $sageSubFamily): self
  109.     {
  110.         if (!$this->sageSubFamilies->contains($sageSubFamily)) {
  111.             $this->sageSubFamilies[] = $sageSubFamily;
  112.             $sageSubFamily->setFamily($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeSageSubFamily(SageSubFamily $sageSubFamily): self
  117.     {
  118.         if ($this->sageSubFamilies->removeElement($sageSubFamily)) {
  119.             // set the owning side to null (unless already changed)
  120.             if ($sageSubFamily->getFamily() === $this) {
  121.                 $sageSubFamily->setFamily(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection<int, SageArticle>
  128.      */
  129.     public function getSageArticles(): Collection
  130.     {
  131.         return $this->sageArticles;
  132.     }
  133.     public function addSageArticle(SageArticle $sageArticle): self
  134.     {
  135.         if (!$this->sageArticles->contains($sageArticle)) {
  136.             $this->sageArticles[] = $sageArticle;
  137.             $sageArticle->setFamily($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeSageArticle(SageArticle $sageArticle): self
  142.     {
  143.         if ($this->sageArticles->removeElement($sageArticle)) {
  144.             // set the owning side to null (unless already changed)
  145.             if ($sageArticle->getFamily() === $this) {
  146.                 $sageArticle->setFamily(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     /**
  152.      * @ORM\PrePersist
  153.      */
  154.     public function prePersist(): void
  155.     {
  156.         $this->createdAt = new \DateTimeImmutable();
  157.         $this->updatedAt = new \DateTimeImmutable();
  158.     }
  159.     /**
  160.      * @ORM\PreUpdate
  161.      */
  162.     public function preUpdate(): void
  163.     {
  164.         $this->updatedAt = new \DateTimeImmutable();
  165.     }
  166. }