src/Entity/PartnerType.php line 13
<?php
namespace App\Entity;
use App\Repository\PartnerTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: PartnerTypeRepository::class)]
class PartnerType
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 191, unique: true)]
#[Gedmo\Slug(fields: ['name'])]
private ?string $slug = null;
#[ORM\OneToMany(mappedBy: 'type', targetEntity: Partner::class)]
private Collection $partners;
public function __construct()
{
$this->partners = new ArrayCollection();
}
public function __toString() {
return $this->name;
}
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 getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Partner>
*/
public function getPartners(): Collection
{
return $this->partners;
}
public function addPartner(Partner $partner): self
{
if (!$this->partners->contains($partner)) {
$this->partners->add($partner);
$partner->setType($this);
}
return $this;
}
public function removePartner(Partner $partner): self
{
if ($this->partners->removeElement($partner)) {
// set the owning side to null (unless already changed)
if ($partner->getType() === $this) {
$partner->setType(null);
}
}
return $this;
}
}