src/Entity/Enquiry.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\DeleteTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Gedmo\Timestampable\Traits\TimestampableEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * Enquiry.
  10. *
  11. * @Gedmo\Loggable
  12. */
  13. #[ORM\Entity(repositoryClass: \App\Repository\EnquiryRepository::class)]
  14. #[ORM\Table(name: 'enquiry')]
  15. class Enquiry implements \Stringable
  16. {
  17. use DeleteTrait;
  18. use TimestampableEntity;
  19. #[ORM\Column(name: 'id', type: 'integer')]
  20. #[ORM\Id]
  21. #[ORM\GeneratedValue(strategy: 'AUTO')]
  22. private int $id;
  23. #[Assert\NotBlank(message: 'Your first name should not be blank')]
  24. #[Assert\Length(min: 3, minMessage: 'Your first name must be at least {{ limit }} characters long')]
  25. #[ORM\Column(name: 'first_name', type: 'string', length: 255)]
  26. private string $firstName;
  27. #[Assert\NotBlank(message: 'Your last name should not be blank')]
  28. #[Assert\Length(min: 3, minMessage: 'Your last name must be at least {{ limit }} characters long')]
  29. #[ORM\Column(name: 'last_name', type: 'string', length: 255)]
  30. private string $lastName;
  31. #[Assert\NotBlank(message: 'Your Email should not be blank')]
  32. #[Assert\Email(message: "The email '{{ value }}' is not a valid email.")]
  33. #[ORM\Column(name: 'email', type: 'string', length: 255)]
  34. private string $email;
  35. #[Assert\NotBlank(message: 'Subject should not be blank')]
  36. #[Assert\Length(min: 3, minMessage: 'Subject must be at least {{ limit }} characters long')]
  37. #[ORM\Column(name: 'subject', type: 'string', length: 255)]
  38. private string $subject;
  39. #[Assert\NotBlank(message: 'Contact number should not be blank')]
  40. #[ORM\Column(name: 'contact_number', type: 'string', length: 255)]
  41. private string $contactNumber;
  42. #[ORM\Column(name: 'company_name', type: 'string', length: 255, nullable: true)]
  43. private ?string $companyName = null;
  44. #[Assert\NotBlank(message: 'Message should not be blank')]
  45. #[Assert\Length(min: 10, minMessage: 'Message must be at least {{ limit }} characters long')]
  46. #[ORM\Column(name: 'message', type: 'text')]
  47. private string $message;
  48. #[ORM\Column(type: 'boolean', nullable: false)]
  49. private bool $viewed = false;
  50. public function __toString(): string
  51. {
  52. return $this->getSubject();
  53. }
  54. public function getId(): int
  55. {
  56. return $this->id;
  57. }
  58. public function setFirstName($firstName): self
  59. {
  60. $this->firstName = $firstName;
  61. return $this;
  62. }
  63. public function getFirstName(): string
  64. {
  65. return $this->firstName;
  66. }
  67. public function setLastName($lastName): self
  68. {
  69. $this->lastName = $lastName;
  70. return $this;
  71. }
  72. public function getLastName(): string
  73. {
  74. return $this->lastName;
  75. }
  76. public function setEmail($email): self
  77. {
  78. $this->email = $email;
  79. return $this;
  80. }
  81. public function getEmail(): string
  82. {
  83. return $this->email;
  84. }
  85. public function setSubject($subject): self
  86. {
  87. $this->subject = $subject;
  88. return $this;
  89. }
  90. public function getSubject(): string
  91. {
  92. return $this->subject;
  93. }
  94. public function setContactNumber($contactNumber): self
  95. {
  96. $this->contactNumber = $contactNumber;
  97. return $this;
  98. }
  99. public function getContactNumber(): string
  100. {
  101. return $this->contactNumber;
  102. }
  103. public function setCompanyName(?string $companyName = null): self
  104. {
  105. $this->companyName = $companyName;
  106. return $this;
  107. }
  108. public function getCompanyName(): ?string
  109. {
  110. return $this->companyName;
  111. }
  112. public function setMessage($message): self
  113. {
  114. $this->message = $message;
  115. return $this;
  116. }
  117. public function getMessage(): string
  118. {
  119. return $this->message;
  120. }
  121. public function setViewed($viewed): self
  122. {
  123. $this->viewed = $viewed;
  124. return $this;
  125. }
  126. public function getViewed(): bool
  127. {
  128. return $this->viewed;
  129. }
  130. }