vendor/score/cms/src/Entity/Document/DocumentDomain.php line 15

Open in your IDE?
  1. <?php
  2. namespace Score\CmsBundle\Entity\Document;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Score\BaseBundle\Entity\BaseEntity;
  7. /**
  8.  * @ORM\Entity()
  9.  * @ORM\Table(name="cms_document_domain")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class DocumentDomain extends BaseEntity
  13. {
  14.     /**
  15.      * @ORM\Column(name="d_name", type="string", length=1000)
  16.      */
  17.     protected $name;
  18.     /**
  19.      * @ORM\Column(name="d_public", type="boolean", nullable=true)
  20.      */
  21.     protected $public;
  22.     /**
  23.      * @ORM\Column(name="d_seo_name", type="string", length=1000, nullable=true)
  24.      */
  25.     protected $seoName;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=DocumentDescription::class, mappedBy="documentDomain", cascade={"persist", "remove"})
  28.      */
  29.     protected $documentDescriptions;
  30.     public function __construct()
  31.     {
  32.         $this->documentDescriptions = new ArrayCollection();
  33.     }
  34.     
  35.     public function __toString()
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function getName(): ?string
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function setName(string $name): self
  44.     {
  45.         $this->name = $name;
  46.         return $this;
  47.     }
  48.     public function getPublic(): ?bool
  49.     {
  50.         return $this->public;
  51.     }
  52.     public function setPublic(?bool $public): self
  53.     {
  54.         $this->public = $public;
  55.         return $this;
  56.     }
  57.     public function getSeoName(): ?string
  58.     {
  59.         return $this->seoName;
  60.     }
  61.     public function setSeoName(?string $seoName): self
  62.     {
  63.         $this->seoName = $seoName;
  64.         return $this;
  65.     }
  66.     /**
  67.      * @return Collection<int, DocumentDescription>
  68.      */
  69.     public function getDocumentDescriptions(): Collection
  70.     {
  71.         return $this->documentDescriptions;
  72.     }
  73.     public function addDocumentDescription(DocumentDescription $documentDescription): self
  74.     {
  75.         if (!$this->documentDescriptions->contains($documentDescription)) {
  76.             $this->documentDescriptions[] = $documentDescription;
  77.             $documentDescription->setDocumentDomain($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeDocumentDescription(DocumentDescription $documentDescription): self
  82.     {
  83.         if ($this->documentDescriptions->removeElement($documentDescription)) {
  84.             // set the owning side to null (unless already changed)
  85.             if ($documentDescription->getDocumentDomain() === $this) {
  86.                 $documentDescription->setDocumentDomain(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91. }