<?php
namespace App\Entity\ReseauSociaux;
use App\Repository\ReseauSociaux\NotificationTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=NotificationTypeRepository::class)
*/
class NotificationType
{
const INVITATION_ESPACE = 'invitationespace';
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups("notif:read")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups("notif:read")
*/
private $label;
/**
* @ORM\OneToMany(targetEntity=Notifications::class, mappedBy="type")
*/
private $notifications;
public function __construct()
{
$this->notifications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
/**
* @return Collection<int, Notifications>
*/
public function getNotifications(): Collection
{
return $this->notifications;
}
public function addNotification(Notifications $notification): self
{
if (!$this->notifications->contains($notification)) {
$this->notifications[] = $notification;
$notification->setType($this);
}
return $this;
}
public function removeNotification(Notifications $notification): self
{
if ($this->notifications->removeElement($notification)) {
// set the owning side to null (unless already changed)
if ($notification->getType() === $this) {
$notification->setType(null);
}
}
return $this;
}
}