src/Entity/Website/PostType/PostType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Website\PostType;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Website\Website\Website;
  5. use App\Repository\Website\PostType\PostTypeRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  10. #[ORM\Entity(repositoryClassPostTypeRepository::class)]
  11. class PostType extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\Column(type'guid'uniquetrue)]
  15.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  16.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  17.     private ?string $id;
  18.     #[ORM\ManyToOne(inversedBy'postTypes')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?Website $website null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $postType null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $themeSlug null;
  25.     #[ORM\OneToMany(mappedBy'postType'targetEntityPostTypeMeta::class)]
  26.     private Collection $postTypeMetas;
  27.     public function __construct()
  28.     {
  29.         parent::__construct();
  30.         $this->postTypeMetas = new ArrayCollection();
  31.     }
  32.     public function getId(): ?string
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getWebsite(): ?Website
  37.     {
  38.         return $this->website;
  39.     }
  40.     public function setWebsite(?Website $shop): static
  41.     {
  42.         $this->website $shop;
  43.         return $this;
  44.     }
  45.     public function getPostType(): ?string
  46.     {
  47.         return $this->postType;
  48.     }
  49.     public function setPostType(string $postType): static
  50.     {
  51.         $this->postType $postType;
  52.         return $this;
  53.     }
  54.     public function getThemeSlug(): ?string
  55.     {
  56.         return $this->themeSlug;
  57.     }
  58.     public function setThemeSlug(string $themeSlug): static
  59.     {
  60.         $this->themeSlug $themeSlug;
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return Collection<int, PostTypeMeta>
  65.      */
  66.     public function getPostTypeMetas(): Collection
  67.     {
  68.         return $this->postTypeMetas;
  69.     }
  70.     public function addPostTypeMeta(PostTypeMeta $postTypeMeta): static
  71.     {
  72.         if (!$this->postTypeMetas->contains($postTypeMeta)) {
  73.             $this->postTypeMetas->add($postTypeMeta);
  74.             $postTypeMeta->setPostType($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removePostTypeMeta(PostTypeMeta $postTypeMeta): static
  79.     {
  80.         if ($this->postTypeMetas->removeElement($postTypeMeta)) {
  81.             // set the owning side to null (unless already changed)
  82.             if ($postTypeMeta->getPostType() === $this) {
  83.                 $postTypeMeta->setPostType(null);
  84.             }
  85.         }
  86.         return $this;
  87.     }
  88. }