src/Entity/Message.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MessageRepository;
  4. use App\Traits\DateTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JMS\Serializer\Annotation as Serializer;
  7. use JMS\Serializer\Annotation\Expose;
  8. use JMS\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=MessageRepository::class)
  11.  * @ORM\HasLifecycleCallbacks
  12.  *
  13.  * @Serializer\ExclusionPolicy("ALL")
  14.  */
  15. class Message
  16. {
  17.     const REQUEST 'request';
  18.     const OK 'ok';
  19.     const KO 'ko';
  20.     const UPDATE 'update';
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue
  24.      * @ORM\Column(type="integer")
  25.      *
  26.      * @Expose
  27.      * @Groups({"messages"})
  28.      */
  29.     private $id;
  30.     /**
  31.      * @ORM\Column(type="string", length=128, nullable=true)
  32.      *
  33.      * @Expose
  34.      * @Groups({"messages"})
  35.      */
  36.     private $slug;
  37.     /**
  38.      * @ORM\Column(type="text", nullable=true)
  39.      *
  40.      * @Expose
  41.      * @Groups({"messages"})
  42.      */
  43.     private $message;
  44.     /**
  45.      * @ORM\Column(type="string", length=128, nullable=true)
  46.      *
  47.      * @Expose
  48.      * @Groups({"messages"})
  49.      */
  50.     private $title;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="senderMessages")
  53.      * @ORM\JoinColumn(nullable=false)
  54.      *
  55.      * @Expose
  56.      * @Groups({"messages"})
  57.      */
  58.     private $sender;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="receiverMessages")
  61.      * @ORM\JoinColumn(nullable=false)
  62.      *
  63.      * @Expose
  64.      * @Groups({"messages"})
  65.      */
  66.     private $receiver;
  67.     /**
  68.      * @ORM\Column(type="boolean")
  69.      *
  70.      * @Expose
  71.      * @Groups({"messages"})
  72.      */
  73.     private $isSenderViewed 0;
  74.     /**
  75.      * @ORM\Column(type="boolean")
  76.      *
  77.      * @Expose
  78.      * @Groups({"messages"})
  79.      */
  80.     private $isReceiverViewed 0;
  81.     /**
  82.      * @ORM\ManyToOne(targetEntity=ScoreArchitecture::class, inversedBy="messages")
  83.      */
  84.     private $scoreArchitecture;
  85.     use DateTrait;
  86.     public function getId(): ?int
  87.     {
  88.         return $this->id;
  89.     }
  90.     public function getSlug(): ?string
  91.     {
  92.         return $this->slug;
  93.     }
  94.     public function setSlug(?string $slug): self
  95.     {
  96.         $this->slug $slug;
  97.         return $this;
  98.     }
  99.     public function getMessage(): ?string
  100.     {
  101.         return $this->message;
  102.     }
  103.     public function setMessage(?string $message): self
  104.     {
  105.         $this->message $message;
  106.         return $this;
  107.     }
  108.     public function getTitle(): ?string
  109.     {
  110.         return $this->title;
  111.     }
  112.     public function setTitle(?string $title): self
  113.     {
  114.         $this->title $title;
  115.         return $this;
  116.     }
  117.     public function getSender(): ?User
  118.     {
  119.         return $this->sender;
  120.     }
  121.     public function setSender(?User $sender): self
  122.     {
  123.         $this->sender $sender;
  124.         return $this;
  125.     }
  126.     public function getReceiver(): ?User
  127.     {
  128.         return $this->receiver;
  129.     }
  130.     public function setReceiver(?User $receiver): self
  131.     {
  132.         $this->receiver $receiver;
  133.         return $this;
  134.     }
  135.     public function isIsSenderViewed(): ?bool
  136.     {
  137.         return $this->isSenderViewed;
  138.     }
  139.     public function setIsSenderViewed(bool $isSenderViewed): self
  140.     {
  141.         $this->isSenderViewed $isSenderViewed;
  142.         return $this;
  143.     }
  144.     public function isIsReceiverViewed(): ?bool
  145.     {
  146.         return $this->isReceiverViewed;
  147.     }
  148.     public function setIsReceiverViewed(bool $isReceiverViewed): self
  149.     {
  150.         $this->isReceiverViewed $isReceiverViewed;
  151.         return $this;
  152.     }
  153.     public function getScoreArchitecture(): ?ScoreArchitecture
  154.     {
  155.         return $this->scoreArchitecture;
  156.     }
  157.     public function setScoreArchitecture(?ScoreArchitecture $scoreArchitecture): self
  158.     {
  159.         $this->scoreArchitecture $scoreArchitecture;
  160.         return $this;
  161.     }
  162. }