src/Products/NotificationsBundle/Entity/Broadcast.php line 35

Open in your IDE?
  1. <?php
  2. namespace Products\NotificationsBundle\Entity;
  3. use App\Entity\Shared\UlidIdentifiableInterface;
  4. use App\Entity\Shared\UlidIdentifiableTrait;
  5. use App\Entity\System\School;
  6. use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableInterface;
  7. use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableTrait;
  8. use Cms\TenantBundle\Model\TenantableInterface;
  9. use Cms\TenantBundle\Model\TenantableTrait;
  10. use DateTime;
  11. use Doctrine\ORM\Mapping as ORM;
  12. /**
  13.  * Class Broadcast
  14.  * @package Products\NotificationsBundle\Entity
  15.  *
  16.  * @ORM\Entity(
  17.  *     repositoryClass = "Products\NotificationsBundle\Doctrine\Repository\BroadcastRepository",
  18.  * )
  19.  * @ORM\Table(
  20.  *     name = "notis__broadcast",
  21.  *     uniqueConstraints = {
  22.  *         @ORM\UniqueConstraint(
  23.  *             name = "uidx__message__profile",
  24.  *             columns = {
  25.  *                 "message",
  26.  *                 "profile",
  27.  *             },
  28.  *         ),
  29.  *     },
  30.  * )
  31.  */
  32. class Broadcast
  33.     implements
  34.         TenantableInterface,
  35.         UlidIdentifiableInterface,
  36.         TimestampableInterface
  37. {
  38.     use TenantableTrait;
  39.     use UlidIdentifiableTrait;
  40.     use TimestampableTrait;
  41.     /**
  42.      * @var AbstractNotification|null
  43.      *
  44.      * @ORM\ManyToOne(
  45.      *     targetEntity = "Products\NotificationsBundle\Entity\AbstractNotification",
  46.      * )
  47.      * @ORM\JoinColumn(
  48.      *     name = "message",
  49.      *     referencedColumnName = "id",
  50.      *     nullable = false,
  51.      *     onDelete = "CASCADE",
  52.      * )
  53.      */
  54.     protected ?AbstractNotification $message null;
  55.     /**
  56.      * @var Profile|null
  57.      *
  58.      * @ORM\ManyToOne(
  59.      *     targetEntity = "Products\NotificationsBundle\Entity\Profile",
  60.      * )
  61.      * @ORM\JoinColumn(
  62.      *     name = "profile",
  63.      *     referencedColumnName = "id",
  64.      *     nullable = false,
  65.      *     onDelete = "CASCADE",
  66.      * )
  67.      */
  68.     protected ?Profile $profile null;
  69.     /**
  70.      * @var School|null
  71.      *
  72.      * @ORM\ManyToOne(
  73.      *     targetEntity = School::class,
  74.      * )
  75.      * @ORM\JoinColumn(
  76.      *     name = "school",
  77.      *     referencedColumnName = "id",
  78.      *     nullable = true,
  79.      *     onDelete = "SET NULL",
  80.      * )
  81.      */
  82.     protected ?School $school null;
  83.     /**
  84.      * @var DateTime|null
  85.      *
  86.      * @ORM\Column(
  87.      *     type = "datetime",
  88.      *     nullable = true,
  89.      * )
  90.      */
  91.     protected ?DateTime $readAt null;
  92.     /**
  93.      * @return AbstractNotification|null
  94.      */
  95.     public function getMessage(): ?AbstractNotification
  96.     {
  97.         return $this->message;
  98.     }
  99.     /**
  100.      * @param AbstractNotification $message
  101.      * @return $this
  102.      */
  103.     public function setMessage(AbstractNotification $message): self
  104.     {
  105.         $this->message $message;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Profile|null
  110.      */
  111.     public function getProfile(): ?Profile
  112.     {
  113.         return $this->profile;
  114.     }
  115.     /**
  116.      * @param Profile $profile
  117.      * @return $this
  118.      */
  119.     public function setProfile(Profile $profile): self
  120.     {
  121.         $this->profile $profile;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return School|null
  126.      */
  127.     public function getSchool(): ?School
  128.     {
  129.         return $this->school;
  130.     }
  131.     /**
  132.      * @param School|null $school
  133.      * @return $this
  134.      */
  135.     public function setSchool(?School $school): self
  136.     {
  137.         $this->school $school;
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return DateTime|null
  142.      */
  143.     public function getReadAt(): ?DateTime
  144.     {
  145.         return $this->readAt;
  146.     }
  147.     /**
  148.      * @param DateTime|null $readAt
  149.      * @return $this
  150.      */
  151.     public function setReadAt(?DateTime $readAt): self
  152.     {
  153.         $this->readAt $readAt;
  154.         return $this;
  155.     }
  156. }