<?phpnamespace App\Entity\Application;use App\Entity\Client;use App\Repository\Application\DeviceTokenRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=DeviceTokenRepository::class) */class DeviceToken{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id; /** * @ORM\Column(type="string", length=255) */ private $token; /** * @ORM\Column(type="string", length=2) */ private $locale = 'cs'; /** * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="deviceTokens") */ private $client; /** * @ORM\Column(type="datetime") */ private $createts; /** * @ORM\OneToMany(targetEntity=NotificationSeen::class, mappedBy="token", orphanRemoval=true) */ private $notificationSeens; public function __construct() { if ($this->getCreatets() === null) { $this->setCreatets(new \DateTime()); } $this->notificationSeens = new ArrayCollection(); } public function setId(?int $id): void { $this->id = $id; } public function getId(): ?int { return $this->id; } public function getToken(): ?string { return $this->token; } public function setToken(string $token): self { $this->token = $token; return $this; } public function getClient(): ?Client { return $this->client; } public function setClient(?Client $client): self { $this->client = $client; return $this; } public function getCreatets(): ?\DateTimeInterface { return $this->createts; } public function setCreatets(\DateTimeInterface $createts): self { $this->createts = $createts; return $this; } /** * @return mixed */ public function getLocale(): string { return $this->locale; } /** * @param mixed $locale */ public function setLocale(string $locale): void { $this->locale = $locale; } /** * @return Collection|NotificationSeen[] */ public function getNotificationSeens(): Collection { return $this->notificationSeens; } public function addNotificationSeen(NotificationSeen $notificationSeen): self { if (!$this->notificationSeens->contains($notificationSeen)) { $this->notificationSeens[] = $notificationSeen; $notificationSeen->setToken($this); } return $this; } public function removeNotificationSeen(NotificationSeen $notificationSeen): self { if ($this->notificationSeens->removeElement($notificationSeen)) { // set the owning side to null (unless already changed) if ($notificationSeen->getToken() === $this) { $notificationSeen->setToken(null); } } return $this; }}