src/Entity/ProductCategory.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\BaseLocalizedWebspaceInterface;
  4. use App\Entity\Trait\BaseLocalizedWebspaceTrait;
  5. use App\Entity\Trait\RoutableTrait;
  6. use App\Entity\Trait\SeoTrait;
  7. use App\Entity\Trait\SocialTrait;
  8. use App\Repository\ProductCategoryRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. #[ORM\Entity(repositoryClassProductCategoryRepository::class)]
  13. #[ORM\Table('app_product_categories')]
  14. class ProductCategory implements BaseLocalizedWebspaceInterface
  15. {
  16.     use BaseLocalizedWebspaceTrait;
  17.     use RoutableTrait;
  18.     use SeoTrait;
  19.     use SocialTrait;
  20.     public const RESOURCE_KEY 'product_categories';
  21.     public const SOCIAL_OG_IMAGES_TABLE 'app_product_category_social_og_images';
  22.     public const SOCIAL_TWITTER_IMAGES_TABLE 'app_product_category_social_twitter_images';
  23.     #[ORM\Id]
  24.     #[ORM\GeneratedValue]
  25.     #[ORM\Column]
  26.     private ?int $id null;
  27.     #[ORM\Column(length255)]
  28.     private ?string $title null;
  29.     #[ORM\Column(length50uniquetruenullabletrue)]
  30.     private ?string $slug null;
  31.     #[ORM\Column(length255)]
  32.     private ?string $importId null;
  33.     #[ORM\Column(nullabletrue)]
  34.     private ?string $content null;
  35.     #[ORM\ManyToMany(targetEntityProduct::class, fetch'EXTRA_LAZY')]
  36.     private Collection $referenceList;
  37.     public function __construct()
  38.     {
  39.         $this->referenceList = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getTitle(): ?string
  46.     {
  47.         return $this->title;
  48.     }
  49.     public function setTitle(string $title): static
  50.     {
  51.         $this->title $title;
  52.         return $this;
  53.     }
  54.     public function getImportId(): ?string
  55.     {
  56.         return $this->importId;
  57.     }
  58.     public function setImportId(string $importId): static
  59.     {
  60.         $this->importId $importId;
  61.         return $this;
  62.     }
  63.     public function getContent(): ?string
  64.     {
  65.         return $this->content;
  66.     }
  67.     public function setContent(?string $content): static
  68.     {
  69.         $this->content $content;
  70.         return $this;
  71.     }
  72.     public function hasSlug(): bool
  73.     {
  74.         return $this->slug !== null;
  75.     }
  76.     public function getSlug(): ?string
  77.     {
  78.         return $this->slug;
  79.     }
  80.     public function setSlug(?string $slug): static
  81.     {
  82.         $this->slug $slug;
  83.         return $this;
  84.     }
  85.     /**
  86.      * @return Collection<int, Product>
  87.      */
  88.     public function getReferenceList(): Collection
  89.     {
  90.         return $this->referenceList;
  91.     }
  92.     public function addReferenceList(Product $referenceList): static
  93.     {
  94.         if (!$this->referenceList->contains($referenceList)) {
  95.             $this->referenceList->add($referenceList);
  96.             $referenceList->addCategory($this);
  97.         }
  98.         return $this;
  99.     }
  100.     public function removeReferenceList(Product $referenceList): static
  101.     {
  102.         if ($this->referenceList->removeElement($referenceList)) {
  103.             $referenceList->removeCategory($this);
  104.         }
  105.         return $this;
  106.     }
  107. }