src/Aqarmap/Bundle/MainBundle/Entity/Feedback.php line 26

Open in your IDE?
  1. <?php
  2. namespace Aqarmap\Bundle\MainBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use JMS\Serializer\Annotation as Serializer;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * Feedback.
  9.  *
  10.  * @ORM\Entity(repositoryClass="Aqarmap\Bundle\MainBundle\Repository\FeedbackRepository")
  11.  *
  12.  * @ORM\Table(name="feedback", indexes={
  13.  *
  14.  *     @ORM\Index(columns={"source"}),
  15.  * })
  16.  *
  17.  * @ORM\HasLifecycleCallbacks
  18.  *
  19.  * @Gedmo\SoftDeleteable(fieldName="deleted_at", timeAware=false)
  20.  *
  21.  * @Serializer\ExclusionPolicy("all")
  22.  */
  23. class Feedback
  24. {
  25.     /**
  26.      * @var int
  27.      *
  28.      * @ORM\Column(name="id", type="integer")
  29.      *
  30.      * @ORM\Id
  31.      *
  32.      * @ORM\GeneratedValue(strategy="AUTO")
  33.      *
  34.      * @Serializer\Expose
  35.      */
  36.     private $id;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="note", type="text",nullable=true)
  41.      */
  42.     private $note;
  43.     /**
  44.      * @var string
  45.      *
  46.      * @ORM\Column(name="author", type="string", length=100)
  47.      *
  48.      * @Assert\NotBlank()
  49.      *
  50.      * @Serializer\Expose
  51.      */
  52.     private $author;
  53.     /**
  54.      * @var string
  55.      *
  56.      * @ORM\Column(name="email", type="string", length=255)
  57.      *
  58.      * @Assert\NotBlank()
  59.      *
  60.      * @Serializer\Expose
  61.      */
  62.     private $email;
  63.     /**
  64.      * @var string
  65.      *
  66.      * @ORM\Column(name="message", type="text")
  67.      *
  68.      * @Assert\NotBlank()
  69.      *
  70.      * @Serializer\Expose
  71.      */
  72.     private $message;
  73.     /**
  74.      * @var string
  75.      *
  76.      * @ORM\Column(name="ip", type="string", length=255)
  77.      *
  78.      * @Serializer\Expose
  79.      */
  80.     private $ip;
  81.     /**
  82.      * @var array
  83.      *
  84.      * @ORM\Column(name="collected_data", type="array")
  85.      */
  86.     private $collectedData;
  87.     /**
  88.      * @var \DateTime
  89.      *
  90.      * @ORM\Column(name="created_at", type="datetime")
  91.      */
  92.     private $createdAt;
  93.     /**
  94.      * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  95.      */
  96.     private $deleted_at;
  97.     /**
  98.      * @var string|null
  99.      *
  100.      * @ORM\Column(name="source", type="string", nullable=true)
  101.      */
  102.     private $source;
  103.     /**
  104.      * Get id.
  105.      *
  106.      * @return int
  107.      */
  108.     public function getId()
  109.     {
  110.         return $this->id;
  111.     }
  112.     /**
  113.      * Set author.
  114.      *
  115.      * @param string $author
  116.      *
  117.      * @return Feedback
  118.      */
  119.     public function setAuthor($author)
  120.     {
  121.         $this->author $author;
  122.         return $this;
  123.     }
  124.     /**
  125.      * Get author.
  126.      *
  127.      * @return string
  128.      */
  129.     public function getAuthor()
  130.     {
  131.         return $this->author;
  132.     }
  133.     /**
  134.      * Set email.
  135.      *
  136.      * @param string $email
  137.      *
  138.      * @return Feedback
  139.      */
  140.     public function setEmail($email)
  141.     {
  142.         $this->email $email;
  143.         return $this;
  144.     }
  145.     /**
  146.      * Get email.
  147.      *
  148.      * @return string
  149.      */
  150.     public function getEmail()
  151.     {
  152.         return $this->email;
  153.     }
  154.     /**
  155.      * Set message.
  156.      *
  157.      * @param string $message
  158.      *
  159.      * @return Feedback
  160.      */
  161.     public function setMessage($message)
  162.     {
  163.         $this->message $message;
  164.         return $this;
  165.     }
  166.     /**
  167.      * Get message.
  168.      *
  169.      * @return string
  170.      */
  171.     public function getMessage()
  172.     {
  173.         return $this->message;
  174.     }
  175.     /**
  176.      * Set ip.
  177.      *
  178.      * @param string $ip
  179.      *
  180.      * @return Feedback
  181.      */
  182.     public function setIp($ip)
  183.     {
  184.         $this->ip $ip;
  185.         return $this;
  186.     }
  187.     /**
  188.      * Get ip.
  189.      *
  190.      * @return string
  191.      */
  192.     public function getIp()
  193.     {
  194.         return $this->ip;
  195.     }
  196.     /**
  197.      * Set collectedData.
  198.      *
  199.      * @param array $collectedData
  200.      *
  201.      * @return Feedback
  202.      */
  203.     public function setCollectedData($collectedData)
  204.     {
  205.         $this->collectedData $collectedData;
  206.         return $this;
  207.     }
  208.     /**
  209.      * Get collectedData.
  210.      *
  211.      * @return array
  212.      */
  213.     public function getCollectedData()
  214.     {
  215.         return $this->collectedData;
  216.     }
  217.     /**
  218.      * Set createdAt.
  219.      *
  220.      * @param \DateTime $createdAt
  221.      *
  222.      * @return Feedback
  223.      */
  224.     public function setCreatedAt($createdAt)
  225.     {
  226.         $this->createdAt $createdAt;
  227.         return $this;
  228.     }
  229.     /**
  230.      * Get createdAt.
  231.      *
  232.      * @return \DateTime
  233.      */
  234.     public function getCreatedAt()
  235.     {
  236.         return $this->createdAt;
  237.     }
  238.     /**
  239.      * @ORM\PrePersist
  240.      */
  241.     public function onPrePersist(): void
  242.     {
  243.         $this->setCreatedAt(new \DateTime());
  244.     }
  245.     /**
  246.      * Set note.
  247.      *
  248.      * @param string $note
  249.      *
  250.      * @return Feedback
  251.      */
  252.     public function setNote($note)
  253.     {
  254.         $this->note $note;
  255.         return $this;
  256.     }
  257.     /**
  258.      * Get note.
  259.      *
  260.      * @return string
  261.      */
  262.     public function getNote()
  263.     {
  264.         return $this->note;
  265.     }
  266.     /**
  267.      * Set deletedAt.
  268.      *
  269.      * @return Feedback
  270.      */
  271.     public function setDeletedAt($deleted_at)
  272.     {
  273.         $this->deleted_at $deleted_at;
  274.         return $this;
  275.     }
  276.     /**
  277.      * Get deletedAt.
  278.      *
  279.      * @return \DateTime
  280.      */
  281.     public function getDeletedAt()
  282.     {
  283.         return $this->deleted_at;
  284.     }
  285.     public function getSource(): ?string
  286.     {
  287.         return $this->source;
  288.     }
  289.     public function setSource(?string $source): self
  290.     {
  291.         $this->source $source;
  292.         return $this;
  293.     }
  294.     public function toArray(): array
  295.     {
  296.         return [
  297.             'author' => $this->getAuthor(),
  298.             'email' => $this->getEmail(),
  299.             'message' => $this->getMessage(),
  300.         ];
  301.     }
  302. }