<?php
namespace Products\NotificationsBundle\Entity;
use App\Entity\Shared\UlidIdentifiableInterface;
use App\Entity\Shared\UlidIdentifiableTrait;
use App\Entity\System\School;
use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableInterface;
use Cms\CoreBundle\Model\Interfaces\Timestampable\TimestampableTrait;
use Cms\TenantBundle\Model\TenantableInterface;
use Cms\TenantBundle\Model\TenantableTrait;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Broadcast
* @package Products\NotificationsBundle\Entity
*
* @ORM\Entity(
* repositoryClass = "Products\NotificationsBundle\Doctrine\Repository\BroadcastRepository",
* )
* @ORM\Table(
* name = "notis__broadcast",
* uniqueConstraints = {
* @ORM\UniqueConstraint(
* name = "uidx__message__profile",
* columns = {
* "message",
* "profile",
* },
* ),
* },
* )
*/
class Broadcast
implements
TenantableInterface,
UlidIdentifiableInterface,
TimestampableInterface
{
use TenantableTrait;
use UlidIdentifiableTrait;
use TimestampableTrait;
/**
* @var AbstractNotification|null
*
* @ORM\ManyToOne(
* targetEntity = "Products\NotificationsBundle\Entity\AbstractNotification",
* )
* @ORM\JoinColumn(
* name = "message",
* referencedColumnName = "id",
* nullable = false,
* onDelete = "CASCADE",
* )
*/
protected ?AbstractNotification $message = null;
/**
* @var Profile|null
*
* @ORM\ManyToOne(
* targetEntity = "Products\NotificationsBundle\Entity\Profile",
* )
* @ORM\JoinColumn(
* name = "profile",
* referencedColumnName = "id",
* nullable = false,
* onDelete = "CASCADE",
* )
*/
protected ?Profile $profile = null;
/**
* @var School|null
*
* @ORM\ManyToOne(
* targetEntity = School::class,
* )
* @ORM\JoinColumn(
* name = "school",
* referencedColumnName = "id",
* nullable = true,
* onDelete = "SET NULL",
* )
*/
protected ?School $school = null;
/**
* @var DateTime|null
*
* @ORM\Column(
* type = "datetime",
* nullable = true,
* )
*/
protected ?DateTime $readAt = null;
/**
* @return AbstractNotification|null
*/
public function getMessage(): ?AbstractNotification
{
return $this->message;
}
/**
* @param AbstractNotification $message
* @return $this
*/
public function setMessage(AbstractNotification $message): self
{
$this->message = $message;
return $this;
}
/**
* @return Profile|null
*/
public function getProfile(): ?Profile
{
return $this->profile;
}
/**
* @param Profile $profile
* @return $this
*/
public function setProfile(Profile $profile): self
{
$this->profile = $profile;
return $this;
}
/**
* @return School|null
*/
public function getSchool(): ?School
{
return $this->school;
}
/**
* @param School|null $school
* @return $this
*/
public function setSchool(?School $school): self
{
$this->school = $school;
return $this;
}
/**
* @return DateTime|null
*/
public function getReadAt(): ?DateTime
{
return $this->readAt;
}
/**
* @param DateTime|null $readAt
* @return $this
*/
public function setReadAt(?DateTime $readAt): self
{
$this->readAt = $readAt;
return $this;
}
}