src/Entity/Newsletter.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\SuperClass\BaseEntity;
  4. use App\Repository\NewsletterRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * @ORM\Entity(repositoryClass=NewsletterRepository::class)
  10. * @UniqueEntity("email" , message="Email is already registered for the monthly insights")
  11. */
  12. class Newsletter extends BaseEntity
  13. {
  14. /**
  15. * @ORM\Column(type="string", length=255 , unique=true )
  16. * @Assert\NotBlank
  17. * @Assert\Email(
  18. * message = "The email '{{ value }}' is not a valid email."
  19. * )
  20. */
  21. private ?string $email;
  22. public function getId(): ?int
  23. {
  24. return $this->id;
  25. }
  26. public function getEmail(): ?string
  27. {
  28. return $this->email;
  29. }
  30. public function setEmail(string $email): self
  31. {
  32. $this->email = $email;
  33. return $this;
  34. }
  35. }