<?phpnamespace App\Entity;use App\Repository\SubscriberRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass=SubscriberRepository::class) * @UniqueEntity("email") */class Subscriber{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="integer", nullable=true) */ protected $tmpOldId; /** * @ORM\Column(type="string", length=255) * @Assert\Email */ private $email; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $name; /** * @ORM\Column(type="boolean") */ private $active = true; /** * @var \DateTime $createdAt * * @Gedmo\Timestampable(on="create") * @ORM\Column(type="datetime", nullable=true) */ private $createdAt; /** * @var \DateTime $updatedAt * * @Gedmo\Timestampable(on="update") * @ORM\Column(type="datetime") */ private $updatedAt; /* relations */ /** * @ORM\ManyToMany(targetEntity=SubscriberList::class, inversedBy="subscribers") */ private $subscriberLists; public function __construct() { $this->active = true; // default $this->createdAt = new \DateTime('now'); // default $this->updatedAt = new \DateTime('now'); // default $this->subscriberLists = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTmpOldId(): ?int { return $this->tmpOldId; } public function setTmpOldId(?int $tmpOldId): self { $this->tmpOldId = $tmpOldId; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getName(): ?string { return $this->name; } public function setName(?string $name): self { $this->name = $name; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * @return Collection|SubscriberList[] */ public function getSubscriberLists(): Collection { return $this->subscriberLists; } public function addSubscriberList(SubscriberList $subscriberList): self { if (!$this->subscriberLists->contains($subscriberList)) { $this->subscriberLists[] = $subscriberList; } return $this; } public function removeSubscriberList(SubscriberList $subscriberList): self { if ($this->subscriberLists->contains($subscriberList)) { $this->subscriberLists->removeElement($subscriberList); } return $this; } }