src/Entity/ContactMessage.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the kProjet project.
  4.  *
  5.  * (c) Kodiom <info@kodiom.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace App\Entity;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. use ApiPlatform\Core\Annotation\ApiResource;
  14. /**
  15.  * ContactMessage
  16.  *
  17.  * @ORM\Table()
  18.  * @ORM\Entity(repositoryClass="App\Entity\ContactMessageRepository")
  19.  * @ApiResource(
  20.  *     collectionOperations={"get"={"method"="GET"}, "post"={"method"="POST"}},
  21.  *     itemOperations={"get"={"method"="GET"}}
  22.  * )
  23.  */
  24. class ContactMessage
  25. {
  26.     /**
  27.      * @var int
  28.      *
  29.      * @ORM\Column(name="id", type="integer")
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue(strategy="AUTO")
  32.      */
  33.     private $id;
  34.     /**
  35.      * @var string
  36.      *
  37.      * @ORM\Column(name="nom", type="string", length=50)
  38.      *
  39.      * @Assert\NotBlank()
  40.      */
  41.     private $nom;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="email", type="string", length=255)
  46.      *
  47.      * @Assert\NotBlank()
  48.      */
  49.     private $email;
  50.     /**
  51.      * @var text
  52.      *
  53.      * @ORM\Column(name="message", type="text")
  54.      *
  55.      * @Assert\NotBlank()
  56.      */
  57.     private $message;
  58.     public function __toString()
  59.     {
  60.         return ($this->getNom()) ? $this->getNom() : '';
  61.     }
  62.     /**
  63.      * Get id
  64.      *
  65.      * @return integer
  66.      */
  67.     public function getId()
  68.     {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * Get nom
  73.      *
  74.      * @return string
  75.      */
  76.     public function getNom()
  77.     {
  78.         return $this->nom;
  79.     }
  80.     /**
  81.      * Set nom
  82.      *
  83.      * @param string $nom
  84.      *
  85.      * @return ContactMessage
  86.      */
  87.     public function setNom($nom)
  88.     {
  89.         $this->nom $nom;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get email
  94.      *
  95.      * @return string
  96.      */
  97.     public function getEmail()
  98.     {
  99.         return $this->email;
  100.     }
  101.     /**
  102.      * Set email
  103.      *
  104.      * @param string $email
  105.      *
  106.      * @return ContactMessage
  107.      */
  108.     public function setEmail($email)
  109.     {
  110.         $this->email $email;
  111.         return $this;
  112.     }
  113.     /**
  114.      * Get message
  115.      *
  116.      * @return text
  117.      */
  118.     public function getMessage()
  119.     {
  120.         return $this->message;
  121.     }
  122.     /**
  123.      * Set message
  124.      *
  125.      * @param text $message
  126.      *
  127.      * @return ContactMessage
  128.      */
  129.     public function setMessage($message)
  130.     {
  131.         $this->message $message;
  132.         return $this;
  133.     }
  134. }