<?phpnamespace App\Entity;use App\Entity\Eventable\EventableTrait;use App\Entity\Sortable\Sortable;use App\Entity\Sortable\SortableInterface;use App\Repository\SponsorRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Uid\Uuid;/** * @ORM\Entity(repositoryClass=SponsorRepository::class) */class Sponsor implements SortableInterface{ use Sortable; const TYPE_SPONSOR = 'sponsor'; const TYPE_PARTNER = 'partner'; /** * @ORM\Id * @ORM\Column(type="uuid", unique=true) */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\ManyToMany(targetEntity=Image::class, cascade={"persist", "remove"}, orphanRemoval=true) */ private $images; /** * @ORM\Column(type="enumsponsortype") */ private $type; /** * @ORM\ManyToMany(targetEntity=Event::class, inversedBy="sponsors") */ private $events; public function __construct() { $this->id = Uuid::v4(); $this->images = new ArrayCollection(); $this->events = new ArrayCollection(); } public function getId(): Uuid { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } /** * @return Collection<int, Image> */ public function getImages(): Collection { return $this->images; } public function addImage(Image $image): self { if (!$this->images->contains($image)) { $this->images[] = $image; } return $this; } public function removeImage(Image $image): self { $this->images->removeElement($image); return $this; } public function getType() { return $this->type; } public function setType($type): self { $this->type = $type; return $this; } /** * @return Collection<int, Event> */ public function getEvents(): Collection { return $this->events; } public function addEvent(Event $event): self { if (!$this->events->contains($event)) { $this->events[] = $event; } return $this; } public function removeEvent(Event $event): self { $this->events->removeElement($event); return $this; }}