<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\LanguageRepository")
* @ORM\Table(name="languages", indexes={@ORM\Index(name="id_index", columns={"id"})})
*/
class Language
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", unique=true, length=20, nullable=false)
*/
private $name;
/**
* @ORM\Column(type="string", unique=true, length=2, nullable=false)
*/
private $code;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $status;
/**
* @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="language")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity="App\Entity\NotificationTemplate", mappedBy="language")
*/
private $notificationTemplates;
public function __construct()
{
$this->users = new ArrayCollection();
$this->notificationTemplates = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setLanguage($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getLanguage() === $this) {
$user->setLanguage(null);
}
}
return $this;
}
/**
* @return Collection<int, NotificationTemplate>
*/
public function getNotificationTemplates(): Collection
{
return $this->notificationTemplates;
}
public function addNotificationTemplate(NotificationTemplate $notificationTemplate): self
{
if (!$this->notificationTemplates->contains($notificationTemplate)) {
$this->notificationTemplates[] = $notificationTemplate;
$notificationTemplate->setLanguage($this);
}
return $this;
}
public function removeNotificationTemplate(NotificationTemplate $notificationTemplate): self
{
if ($this->notificationTemplates->removeElement($notificationTemplate)) {
// set the owning side to null (unless already changed)
if ($notificationTemplate->getLanguage() === $this) {
$notificationTemplate->setLanguage(null);
}
}
return $this;
}
}