| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <?php
- namespace AppBundle\Entity\Message;
- use AppBundle\Entity\Organization\Organization;
- use AppBundle\Entity\Place\Place;
- use AppBundle\Entity\Place\Room;
- use AppBundle\Services\Messenger\Reporter\ReporterManager;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Logs des envois de messages (mails, sms, courriers)
- *
- * @Iri("http://schema.org/ReportMessage")
- */
- #[ORM\Entity]
- #[ORM\Table(name: 'ReportMessage')]
- #[ORM\Index(name: 'recipientType', columns: ['recipientType'])]
- #[ORM\Index(name: 'recipientId', columns: ['recipientId'])]
- class ReportMessage
- {
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['reportmessage', 'messagesend_list'])]
- private $id;
- /**
- *
- * @var MessageInterface
- *
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Message\Message', inversedBy: 'reportMessage')]
- #[Assert\NotNull]
- #[Groups(['reportmessage'])]
- private $message;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime')]
- #[Assert\DateTime]
- #[Assert\NotNull]
- #[Groups(['reportmessage', 'report'])]
- private $dateSend;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string')]
- #[Assert\NotNull]
- #[Groups(['reportmessage'])]
- private $recipientType;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[Assert\NotNull]
- #[Groups(['reportmessage'])]
- private $recipientId;
- /**
- * @var string
- */
- #[Groups(['report', 'messagesend_list_reportmessage'])]
- private $recipient;
- /**
- * @var ReporterManager
- */
- protected $reporterManager;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string')]
- #[Assert\Type(type: 'string')]
- #[Assert\NotNull]
- #[Assert\Choice(callback: ['AppBundle\Enum\Message\ReportMessageSatusEnum', 'toArray'])]
- #[Groups(['reportmessage', 'report'])]
- private $status;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['reportmessage', 'report'])]
- private $smsId;
- public function __construct()
- {
- $this->dateSend = new \DateTime();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set dateSend
- *
- * @param \DateTime $dateSend
- *
- * @return ReportMessage
- */
- public function setDateSend($dateSend)
- {
- $this->dateSend = $dateSend;
- return $this;
- }
- /**
- * Get dateSend
- *
- * @return \DateTime
- */
- public function getDateSend()
- {
- return $this->dateSend;
- }
- /**
- * Set status
- *
- * @param string $status
- *
- * @return ReportMessage
- */
- public function setStatus($status)
- {
- $this->status = $status;
- return $this;
- }
- /**
- * Get status
- *
- * @return string
- */
- public function getStatus()
- {
- return $this->status;
- }
- /**
- * Set message
- *
- * @param \AppBundle\Entity\Message\Message $message
- *
- * @return ReportMessage
- */
- public function setMessage(\AppBundle\Entity\Message\Message $message)
- {
- $this->message = $message;
- return $this;
- }
- /**
- * Get message
- *
- * @return \AppBundle\Entity\Message\Message
- */
- public function getMessage()
- {
- return $this->message;
- }
- /**
- * Gets sms id
- *
- * @return string
- */
- public function getSmsId() {
- return $this->smsId;
- }
- /**
- * Sets sms id
- *
- * @param string $smsId
- * @return $this
- */
- public function setSmsId($smsId) {
- $this->smsId = $smsId;
- return $this;
- }
- /**
- * Set recipient
- *
- * @param string $recipientType
- *
- * @return ReportMessage
- */
- public function setRecipientType($recipientType)
- {
- $this->recipientType = $recipientType;
- return $this;
- }
- /**
- * Get recipient
- *
- * @return string
- */
- public function getRecipientType()
- {
- return $this->recipientType;
- }
- /**
- * Get the recipient id
- *
- * @return type
- */
- public function getRecipientId() {
- return $this->recipientId;
- }
- /**
- * Set the recipient id
- *
- * @param type $recipientId
- * @return $this
- */
- public function setRecipientId($recipientId) {
- $this->recipientId = $recipientId;
- return $this;
- }
- /**
- * {@inheritdoc}
- */
- public function getRecipient()
- {
- if (!$this->recipient) {
- if ($this->reporterManager) {
- return $this->reporterManager->loadRecipient($this);
- }
- }
- return null;
- }
- /**
- * {@inheritdoc}
- */
- public function setReportManagerr(ReporterManager $reporterManager)
- {
- $this->reporterManager = $reporterManager;
- }
- }
|