src/Entity/Newsletter.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. /**
  6. * @UniqueEntity(fields={"email", "locale"})
  7. * @ORM\Table(
  8. * uniqueConstraints={
  9. * @ORM\UniqueConstraint(name="email_locale", columns={"email", "locale","source"})
  10. * }
  11. * )
  12. * @ORM\Entity(repositoryClass="App\Repository\NewsletterRepository")
  13. */
  14. class Newsletter
  15. {
  16. /**
  17. * @ORM\Id()
  18. * @ORM\GeneratedValue()
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="string", length=180)
  24. */
  25. private $email;
  26. /**
  27. * @ORM\Column(type="string", length=4)
  28. */
  29. private $locale;
  30. /**
  31. * @ORM\Column(type="datetime")
  32. */
  33. private $createts;
  34. /**
  35. * @ORM\Column(type="string", length=255, nullable=true)
  36. */
  37. private $ip;
  38. /**
  39. * @ORM\Column(type="string", length=20, nullable=true)
  40. */
  41. private $source = 'eshop';
  42. /**
  43. * @ORM\Column(type="boolean")
  44. */
  45. private $isActive = true;
  46. public function getId(): ?int
  47. {
  48. return $this->id;
  49. }
  50. public function getEmail(): ?string
  51. {
  52. return $this->email;
  53. }
  54. public function setEmail(string $email): self
  55. {
  56. $this->email = $email;
  57. return $this;
  58. }
  59. public function getCreatets(): ?\DateTimeInterface
  60. {
  61. return $this->createts;
  62. }
  63. public function setCreatets(\DateTimeInterface $createts): self
  64. {
  65. $this->createts = $createts;
  66. return $this;
  67. }
  68. public function getIp(): ?string
  69. {
  70. return $this->ip;
  71. }
  72. public function setIp(?string $ip): self
  73. {
  74. $this->ip = $ip;
  75. return $this;
  76. }
  77. public function getIsActive(): ?bool
  78. {
  79. return $this->isActive;
  80. }
  81. public function setIsActive(bool $isActive): self
  82. {
  83. $this->isActive = $isActive;
  84. return $this;
  85. }
  86. /**
  87. * Get Locale
  88. *
  89. * @return mixed
  90. */
  91. public function getLocale()
  92. {
  93. return $this->locale;
  94. }
  95. /**
  96. * Set Locale
  97. *
  98. * @param mixed $locale
  99. */
  100. public function setLocale( $locale )
  101. {
  102. $this->locale = $locale;
  103. }
  104. /**
  105. * @return mixed
  106. */
  107. public function getSource()
  108. {
  109. return $this->source;
  110. }
  111. /**
  112. * @param mixed $source
  113. */
  114. public function setSource($source): void
  115. {
  116. $this->source = $source;
  117. }
  118. }