src/Entity/AdditionalServices.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\MainTranslationTrait;
  4. use App\Entity\Translation\AdditionalServicesTranslation;
  5. use App\Repository\AdditionalServicesRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Gedmo\Translatable\Translatable;
  10. use Doctrine\Common\Collections\Collection;
  11. #[ORM\Table(name'additional_services')]
  12. #[ORM\Entity(repositoryClassAdditionalServicesRepository::class)]
  13. #[Gedmo\TranslationEntity(class: AdditionalServicesTranslation::class)]
  14. class AdditionalServices implements Translatable
  15. {
  16.     use MainTranslationTrait;
  17.     const TRANSLATION_ENTITY AdditionalServicesTranslation::class;
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(type'string'nullabletrue)]
  23.     #[Gedmo\Translatable]
  24.     private ?string $title null;
  25.     #[ORM\Column(type'text'nullabletrue)]
  26.     #[Gedmo\Translatable]
  27.     private ?string $description null;
  28.     #[ORM\Column(type'json'nullabletrue)]
  29.     #[Gedmo\Translatable]
  30.     private ?array $services null;
  31.     #[ORM\Column(type'string'nullabletrue)]
  32.     private ?string $image null;
  33.     #[ORM\ManyToMany(targetEntityYourEvents::class, mappedBy'additionalServices')]
  34.     private $yourEvents;
  35.     public function __construct()
  36.     {
  37.         $this->yourEvents = new ArrayCollection();
  38.     }
  39.     public function getYourEvents(): Collection
  40.     {
  41.         return $this->yourEvents;
  42.     }
  43.     public function addYourEvent(YourEvents $yourEvent): self
  44.     {
  45.         if (!$this->yourEvents->contains($yourEvent)) {
  46.             $this->yourEvents[] = $yourEvent;
  47.             $yourEvent->addAdditionalService($this);
  48.         }
  49.         return $this;
  50.     }
  51.     public function removeYourEvent(YourEvents $yourEvent): self
  52.     {
  53.         if ($this->yourEvents->removeElement($yourEvent)) {
  54.             $yourEvent->removeAdditionalService($this);
  55.         }
  56.         return $this;
  57.     }
  58.     public function __toString(): string
  59.     {
  60.         return $this->title ?? "";
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getTitle(): ?string
  67.     {
  68.         return $this->title;
  69.     }
  70.     public function setTitle(?string $title): static
  71.     {
  72.         $this->title $title;
  73.         return $this;
  74.     }
  75.     public function getDescription(): ?string
  76.     {
  77.         return $this->description;
  78.     }
  79.     public function setDescription(?string $description): void
  80.     {
  81.         $this->description $description;
  82.     }
  83.     public function getServices(): ?array
  84.     {
  85.         return $this->services;
  86.     }
  87.     public function setServices(?array $services): static
  88.     {
  89.         $this->services $services;
  90.         return $this;
  91.     }
  92.     public function getImage(): ?string
  93.     {
  94.         return $this->image;
  95.     }
  96.     public function setImage(?string $image): static
  97.     {
  98.         $this->image $image;
  99.         return $this;
  100.     }
  101. }