src/Entity/EnquiryCV.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\Traits\DeleteTrait;
  5. use App\Entity\Traits\TranslateTrait;
  6. use App\Entity\Traits\FileUploadTrait;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use App\Repository\EnquiryCVRepository;
  9. use Gedmo\Timestampable\Traits\TimestampableEntity;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12. * @Gedmo\Loggable
  13. */
  14. #[ORM\Entity(repositoryClass: EnquiryCVRepository::class)]
  15. class EnquiryCV
  16. {
  17. use TimestampableEntity;
  18. use TranslateTrait;
  19. use FileUploadTrait;
  20. use DeleteTrait;
  21. #[ORM\Id]
  22. #[ORM\GeneratedValue]
  23. #[ORM\Column(type:"integer")]
  24. private $id;
  25. #[Assert\NotBlank(message: 'Your name should not be blank')]
  26. #[Assert\Length(min: 3, minMessage: 'Your name must be at least {{ limit }} characters long')]
  27. #[ORM\Column(name: 'name', type: 'string', length: 255)]
  28. private string $name;
  29. #[Assert\NotBlank(message: 'Your Email should not be blank')]
  30. #[Assert\Email(message: "The email '{{ value }}' is not a valid email.")]
  31. #[ORM\Column(name: 'email', type: 'string', length: 255)]
  32. private string $email;
  33. #[Assert\NotBlank(message: 'Contact number should not be blank')]
  34. #[ORM\Column(name: 'contact_number', type: 'string', length: 255)]
  35. private string $contactNumber;
  36. #[Assert\NotBlank(message: 'About you should not be blank')]
  37. #[Assert\Length(min: 10, minMessage: 'About you must be at least {{ limit }} characters long')]
  38. #[ORM\Column(name: 'aboutYou', type: 'text')]
  39. private string $aboutYou;
  40. #[ORM\Column(type: 'boolean')]
  41. private $viewed = false;
  42. public function __construct()
  43. {
  44. $this->viewed = false;
  45. }
  46. public function getId(): ?int
  47. {
  48. return $this->id;
  49. }
  50. public function getName(): ?string
  51. {
  52. return $this->name;
  53. }
  54. public function setName(string $name): self
  55. {
  56. $this->name = $name;
  57. return $this;
  58. }
  59. public function getEmail(): ?string
  60. {
  61. return $this->email;
  62. }
  63. public function setEmail(string $email): self
  64. {
  65. $this->email = $email;
  66. return $this;
  67. }
  68. public function getContactNumber(): ?string
  69. {
  70. return $this->contactNumber;
  71. }
  72. public function setContactNumber(string $contactNumber): self
  73. {
  74. $this->contactNumber = $contactNumber;
  75. return $this;
  76. }
  77. public function getAboutYou(): ?string
  78. {
  79. return $this->aboutYou;
  80. }
  81. public function setAboutYou(string $aboutYou): self
  82. {
  83. $this->aboutYou = $aboutYou;
  84. return $this;
  85. }
  86. // OVERRIDE FILE UPLOAD TRAIT
  87. public function getFolder(): string
  88. {
  89. $classname = strtolower(
  90. (new \ReflectionClass($this))->getShortName()
  91. );
  92. return '/../cvs';
  93. }
  94. public function getViewed(): ?bool
  95. {
  96. return $this->viewed;
  97. }
  98. public function setViewed(bool $viewed): self
  99. {
  100. $this->viewed = $viewed;
  101. return $this;
  102. }
  103. }