src/Entity/Contact.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\ContactRepository")
  7.  */
  8. class Contact
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=255)
  18.      */
  19.     private $subject;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private $email;
  28.     /**
  29.      * @ORM\Column(type="text")
  30.      */
  31.     private $message;
  32.     /**
  33.      * @ORM\Column(type="boolean")
  34.      */
  35.     private $sent 0;
  36.     /**
  37.      * @var \DateTime $createdAt
  38.      *
  39.      * @Gedmo\Timestampable(on="create")
  40.      * @ORM\Column(type="datetime", nullable=true)
  41.      */
  42.     protected $createdAt;
  43.     public function __construct()
  44.     {
  45.         $this->createdAt = new \DateTime('now'); // default 
  46.     }
  47.     public function __toString()
  48.     {
  49.         return $this->createdAt " / " $this->subject "(" $this->name ")";
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getSubject(): ?string
  56.     {
  57.         return $this->subject;
  58.     }
  59.     public function setSubject(string $subject): self
  60.     {
  61.         $this->subject $subject;
  62.         return $this;
  63.     }
  64.     public function getName(): ?string
  65.     {
  66.         return $this->name;
  67.     }
  68.     public function setName(string $name): self
  69.     {
  70.         $this->name $name;
  71.         return $this;
  72.     }
  73.     public function getEmail(): ?string
  74.     {
  75.         return $this->email;
  76.     }
  77.     public function setEmail(string $email): self
  78.     {
  79.         $this->email $email;
  80.         return $this;
  81.     }
  82.     public function getMessage(): ?string
  83.     {
  84.         return $this->message;
  85.     }
  86.     public function setMessage(string $message): self
  87.     {
  88.         $this->message $message;
  89.         return $this;
  90.     }
  91.     public function getSent(): ?bool
  92.     {
  93.         return $this->sent;
  94.     }
  95.     public function setSent(bool $sent): self
  96.     {
  97.         $this->sent $sent;
  98.         return $this;
  99.     }
  100.     public function getCreatedAt(): ?\DateTimeInterface
  101.     {
  102.         return $this->createdAt;
  103.     }
  104.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  105.     {
  106.         $this->createdAt $createdAt;
  107.         return $this;
  108.     }
  109. }