src/Entity/Documents/DocumentCategory.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Documents;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\PublishedInterface;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\MiniAbstractBase;
  8. use App\Entity\Traits\NameTrait;
  9. use App\Entity\Traits\PositionTrait;
  10. use App\Entity\Traits\PublishedTrait;
  11. use App\Entity\Traits\SiteTrait;
  12. use App\Repository\Documents\DocumentCategoryRepository;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. /**
  18.  * @ORM\Table(name="vulco_document_category", indexes={@ORM\Index(name="document_category_site_idx", columns={"site"})})
  19.  * @ORM\Entity(repositoryClass=DocumentCategoryRepository::class)
  20.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  21.  * @SiteAware(siteFieldName="site")
  22.  */
  23. class DocumentCategory extends AbstractBase implements SiteInterfacePublishedInterface
  24. {
  25.     use NameTrait;
  26.     use PositionTrait;
  27.     use PublishedTrait;
  28.     use SiteTrait;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=false)
  31.      */
  32.     private string $name;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=false)
  35.      */
  36.     private int $position 1;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="App\Entity\Documents\DocumentCategoryFamily", inversedBy="documentCategories")
  39.      * @ORM\JoinColumn(name="document_category_family_id", referencedColumnName="id")
  40.      */
  41.     private ?DocumentCategoryFamily $family null;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity="App\Entity\Documents\Document", mappedBy="documentCategory", orphanRemoval=true)
  44.      */
  45.     private ?Collection $documents;
  46.     public function __construct()
  47.     {
  48.         $this->documents = new ArrayCollection();
  49.     }
  50.     public function getFamily(): ?DocumentCategoryFamily
  51.     {
  52.         return $this->family;
  53.     }
  54.     public function getDocumentCategoryFamily(): ?DocumentCategoryFamily
  55.     {
  56.         return $this->getFamily();
  57.     }
  58.     public function setFamily(?DocumentCategoryFamily $family): self
  59.     {
  60.         $this->family $family;
  61.         return $this;
  62.     }
  63.     public function setDocumentCategoryFamily(?DocumentCategoryFamily $documentCategoryFamily): self
  64.     {
  65.         return $this->setFamily($documentCategoryFamily);
  66.     }
  67.     public function getDocuments(): ?Collection
  68.     {
  69.         return $this->documents;
  70.     }
  71.     public function setDocuments(?Collection $documents): self
  72.     {
  73.         $this->documents $documents;
  74.         return $this;
  75.     }
  76.     public function __toString(): string
  77.     {
  78.         return $this->id $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  79.     }
  80. }