src/Aqarmap/Bundle/MainBundle/Entity/Feedback.php line 26
<?php
namespace Aqarmap\Bundle\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: \Aqarmap\Bundle\MainBundle\Repository\FeedbackRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'feedback')]
#[ORM\Index(columns: ['source'])]
#[Gedmo\SoftDeleteable(fieldName: 'deleted_at', timeAware: false)]
#[Serializer\ExclusionPolicy('all')]
class Feedback
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[Serializer\Expose]
private $id;
/**
* @var string
*/
#[ORM\Column(name: 'note', type: 'text', nullable: true)]
private $note;
/**
* @var string
*/
#[Assert\NotBlank]
#[ORM\Column(name: 'author', type: 'string', length: 100)]
#[Serializer\Expose]
private $author;
/**
* @var string
*/
#[Assert\NotBlank]
#[ORM\Column(name: 'email', type: 'string', length: 255)]
#[Serializer\Expose]
private $email;
/**
* @var string
*/
#[Assert\NotBlank]
#[ORM\Column(name: 'message', type: 'text')]
#[Serializer\Expose]
private $message;
/**
* @var string
*/
#[ORM\Column(name: 'ip', type: 'string', length: 255)]
#[Serializer\Expose]
private $ip;
/**
* @var array
*/
#[ORM\Column(name: 'collected_data', type: 'array')]
private $collectedData;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'created_at', type: 'datetime')]
private $createdAt;
#[ORM\Column(name: 'deleted_at', type: 'datetime', nullable: true)]
private $deleted_at;
/**
* @var string|null
*/
#[ORM\Column(name: 'source', type: 'string', nullable: true)]
private $source;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set author.
*
* @param string $author
*
* @return Feedback
*/
public function setAuthor($author)
{
$this->author = $author;
return $this;
}
/**
* Get author.
*
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* Set email.
*
* @param string $email
*
* @return Feedback
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email.
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set message.
*
* @param string $message
*
* @return Feedback
*/
public function setMessage($message)
{
$this->message = $message;
return $this;
}
/**
* Get message.
*
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Set ip.
*
* @param string $ip
*
* @return Feedback
*/
public function setIp($ip)
{
$this->ip = $ip;
return $this;
}
/**
* Get ip.
*
* @return string
*/
public function getIp()
{
return $this->ip;
}
/**
* Set collectedData.
*
* @param array $collectedData
*
* @return Feedback
*/
public function setCollectedData($collectedData)
{
$this->collectedData = $collectedData;
return $this;
}
/**
* Get collectedData.
*
* @return array
*/
public function getCollectedData()
{
return $this->collectedData;
}
/**
* Set createdAt.
*
* @param \DateTime $createdAt
*
* @return Feedback
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt.
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
#[ORM\PrePersist]
public function onPrePersist(): void
{
$this->setCreatedAt(new \DateTime());
}
/**
* Set note.
*
* @param string $note
*
* @return Feedback
*/
public function setNote($note)
{
$this->note = $note;
return $this;
}
/**
* Get note.
*
* @return string
*/
public function getNote()
{
return $this->note;
}
/**
* Set deletedAt.
*
* @return Feedback
*/
public function setDeletedAt($deleted_at)
{
$this->deleted_at = $deleted_at;
return $this;
}
/**
* Get deletedAt.
*
* @return \DateTime
*/
public function getDeletedAt()
{
return $this->deleted_at;
}
public function getSource(): ?string
{
return $this->source;
}
public function setSource(?string $source): self
{
$this->source = $source;
return $this;
}
public function toArray(): array
{
return [
'author' => $this->getAuthor(),
'email' => $this->getEmail(),
'message' => $this->getMessage(),
];
}
}