| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?php
- namespace AppBundle\Entity\Core;
- use AppBundle\Entity\Organization\Organization;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Validator\Constraints as Assert;
- use Doctrine\Common\Collections\ArrayCollection;
- use Symfony\Component\Serializer\Annotation\Groups;
- use AppBundle\Annotation\DefaultField;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- /**
- * Classe de base des notifications et des tips
- *
- *
- */
- #[ORM\Entity]
- #[ORM\Table(name: 'Information')]
- #[ORM\InheritanceType('SINGLE_TABLE')]
- #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
- #[ORM\DiscriminatorMap(['notification' => 'Notification', 'tips' => 'Tips'])]
- abstract class AbstractInformation
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['information', 'tips', 'notification'])]
- private $id;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 40, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['information', 'tips', 'notification'])]
- private $name;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: true)]
- #[Assert\DateTime]
- #[Groups(['information', 'tips', 'notification'])]
- private $datetimeStart;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: true)]
- #[Assert\DateTime]
- #[Groups(['information', 'tips', 'notification'])]
- private $datetimeEnd;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => true])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['information', 'tips', 'notification'])]
- private $activate = true;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => 0])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['information', 'tips', 'notification'])]
- private $isSystem = false;
- /**
- * @var ArrayCollection<NotificationUser>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'NotificationUser', mappedBy: 'notification', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['information', 'tips', 'notification'])]
- private $notificationUsers;
- /**
- * The constructor
- */
- public function __construct() {
- $this->notificationUsers = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set activate
- *
- * @param boolean $activate
- *
- * @return AbstractInformation
- */
- public function setActivate($activate)
- {
- $this->activate = $activate;
- return $this;
- }
- /**
- * Get activate
- *
- * @return boolean
- */
- public function getActivate()
- {
- return $this->activate;
- }
- /**
- * Set isSystem
- *
- * @param boolean $isSystem
- *
- * @return AbstractInformation
- */
- public function setIsSystem($isSystem)
- {
- $this->isSystem = $isSystem;
- return $this;
- }
- /**
- * Get isSystem
- *
- * @return boolean
- */
- public function getIsSystem()
- {
- return $this->isSystem;
- }
- /**
- * Set name
- *
- * @param string $name
- *
- * @return AbstractInformation
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set datetimeStart
- *
- * @param \DateTime $datetimeStart
- *
- * @return AbstractInformation
- */
- public function setDatetimeStart($datetimeStart)
- {
- $this->datetimeStart = $datetimeStart;
- return $this;
- }
- /**
- * Get datetimeStart
- *
- * @return \DateTime
- */
- public function getDatetimeStart()
- {
- return $this->datetimeStart;
- }
- /**
- * Set datetimeEnd
- *
- * @param \DateTime $datetimeEnd
- *
- * @return AbstractInformation
- */
- public function setDatetimeEnd($datetimeEnd)
- {
- $this->datetimeEnd = $datetimeEnd;
- return $this;
- }
- /**
- * Get datetimeEnd
- *
- * @return \DateTime
- */
- public function getDatetimeEnd()
- {
- return $this->datetimeEnd;
- }
- /**
- * Adds notificationUser.
- *
- * @param NotificationUser $notificationUser
- * @return $this
- */
- public function addNotificationUser(NotificationUser $notificationUser) {
- $notificationUser->setNotification($this);
- $this->notificationUsers->add($notificationUser);
- return $this;
- }
- /**
- * Remove $notificationUse.
- *
- * @param NotificationUser $notificationUser
- * @return $this
- */
- public function removeNotificationUser(NotificationUser $notificationUser) {
- $notificationUser->setNotification(null);
- $this->notificationUsers->remove($notificationUser);
- return $this;
- }
- /**
- * Gets notificationUsers
- *
- * @return ArrayCollection<NotificationUser>
- */
- public function getNotificationUsers() {
- return $this->notificationUsers;
- }
- }
|