src/Entity/ConfidentialDocument.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ConfidentialDocumentRepository")
  8.  *
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class ConfidentialDocument
  12. {
  13.     public function __construct()
  14.     {
  15.         $this->images = new ArrayCollection();
  16.         $this->user_documents = new ArrayCollection();
  17.         $this->products = new ArrayCollection();
  18.     }
  19.     /**
  20.      * @ORM\Id()
  21.      *
  22.      * @ORM\GeneratedValue()
  23.      *
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $title;
  31.     /**
  32.      * @ORM\Column(type="datetime", nullable=false)
  33.      */
  34.     private $created_at;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity="App\Entity\ConfidentialDocumentImage", mappedBy="confidential_document")
  37.      */
  38.     private $images;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity="App\Entity\UserConfidentialDocument", mappedBy="confidential_document")
  41.      */
  42.     private $user_documents;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity="App\Entity\ConfidentialDocumentProduct", mappedBy="confidential_document")
  45.      */
  46.     private $products;
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getTitle()
  52.     {
  53.         return $this->title;
  54.     }
  55.     public function setTitle($title)
  56.     {
  57.         $this->title $title;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @ORM\PrePersist
  62.      */
  63.     public function setCreatedAtValue()
  64.     {
  65.         $this->setCreatedAt(new \DateTime());
  66.     }
  67.     public function getCreatedAt(): \DateTimeInterface
  68.     {
  69.         return $this->created_at;
  70.     }
  71.     public function setCreatedAt(\DateTimeInterface $created_at): self
  72.     {
  73.         $this->created_at $created_at;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection|ConfidentialDocumentImage[]
  78.      */
  79.     public function getImages(): Collection
  80.     {
  81.         return $this->images;
  82.     }
  83.     public function addImage(ConfidentialDocumentImage $image): self
  84.     {
  85.         if (!$this->images->contains($image)) {
  86.             $this->images[] = $image;
  87.             $image->setConfidentialDocument($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeImage(ConfidentialDocumentImage $image): self
  92.     {
  93.         if ($this->images->contains($image)) {
  94.             $this->images->removeElement($image);
  95.             if ($image->getConfidentialDocument() === $this) {
  96.                 $image->setConfidentialDocument(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection|UserConfidentialDocument[]
  103.      */
  104.     public function getUserDocuments(): Collection
  105.     {
  106.         return $this->user_documents;
  107.     }
  108.     public function addUserDocument(UserConfidentialDocument $user_document): self
  109.     {
  110.         if (!$this->user_documents->contains($user_document)) {
  111.             $this->user_documents[] = $user_document;
  112.             $user_document->setConfidentialDocument($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeUserDocument(UserConfidentialDocument $user_document): self
  117.     {
  118.         if ($this->user_documents->contains($user_document)) {
  119.             $this->user_documents->removeElement($user_document);
  120.             if ($user_document->getConfidentialDocument() === $this) {
  121.                 $user_document->setConfidentialDocument(null);
  122.             }
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection|ConfidentialDocumentProduct[]
  128.      */
  129.     public function getProducts(): Collection
  130.     {
  131.         return $this->products;
  132.     }
  133.     public function addProduct(ConfidentialDocumentProduct $product): self
  134.     {
  135.         if (!$this->products->contains($product)) {
  136.             $this->products[] = $product;
  137.             $product->setConfidentialDocument($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeProduct(ConfidentialDocumentProduct $product): self
  142.     {
  143.         if ($this->products->contains($product)) {
  144.             $this->products->removeElement($product);
  145.             if ($product->getConfidentialDocument() === $this) {
  146.                 $product->setConfidentialDocument(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151. }