2022-07-21 16:15:47 +02:00
|
|
|
<?php
|
2022-09-23 16:14:15 +02:00
|
|
|
|
2022-07-21 16:15:47 +02:00
|
|
|
namespace App\Entity;
|
|
|
|
|
2022-09-23 16:14:15 +02:00
|
|
|
use App\Validator;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
2022-07-21 16:15:47 +02:00
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Entity
|
|
|
|
* @ORM\Table(name="niveau02")
|
|
|
|
* @ORM\HasLifecycleCallbacks()
|
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\Niveau02Repository")
|
|
|
|
*
|
|
|
|
* @UniqueEntity(fields="label", message="Un Niveau de rang 2 existe déjà avec ce label")
|
|
|
|
*/
|
|
|
|
class Niveau02
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=250, unique=true)
|
|
|
|
* @Validator\Grouplabel()
|
|
|
|
* @Validator\Niveau02unique()
|
|
|
|
*/
|
|
|
|
private $label;
|
2022-09-23 16:14:15 +02:00
|
|
|
|
2022-07-21 16:15:47 +02:00
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string")
|
|
|
|
*/
|
|
|
|
private $apikey;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\ManyToOne(targetEntity="Niveau01", inversedBy="niveau02s")
|
|
|
|
* @ORM\JoinColumn(nullable=false)
|
|
|
|
*/
|
|
|
|
private $niveau01;
|
2022-09-23 16:14:15 +02:00
|
|
|
|
2022-09-27 11:52:49 +02:00
|
|
|
/**
|
|
|
|
* @var ArrayCollection
|
|
|
|
* @var Registration
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="Niveau03", mappedBy="niveau02", cascade={"persist"}, orphanRemoval=false)
|
|
|
|
*/
|
|
|
|
private $niveau03s;
|
|
|
|
|
2022-07-21 16:15:47 +02:00
|
|
|
/**
|
2022-09-23 16:14:15 +02:00
|
|
|
* @var ArrayCollection
|
2022-07-21 16:15:47 +02:00
|
|
|
* @var Registration
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="Registration", mappedBy="niveau02", cascade={"persist"}, orphanRemoval=false)
|
|
|
|
*/
|
|
|
|
private $registrations;
|
|
|
|
|
2022-09-23 16:14:15 +02:00
|
|
|
/**
|
|
|
|
* @var ArrayCollection
|
2022-07-21 16:15:47 +02:00
|
|
|
* @var User
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="User", mappedBy="niveau02", cascade={"persist"}, orphanRemoval=false)
|
|
|
|
*/
|
|
|
|
private $users;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
2022-09-27 11:52:49 +02:00
|
|
|
$this->niveau03s = new ArrayCollection();
|
2022-07-21 16:15:47 +02:00
|
|
|
$this->registrations = new ArrayCollection();
|
|
|
|
$this->users = 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApikey(): ?string
|
|
|
|
{
|
|
|
|
return $this->apikey;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setApikey(string $apikey): self
|
|
|
|
{
|
|
|
|
$this->apikey = $apikey;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNiveau01(): ?Niveau01
|
|
|
|
{
|
|
|
|
return $this->niveau01;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setNiveau01(?Niveau01 $niveau01): self
|
|
|
|
{
|
|
|
|
$this->niveau01 = $niveau01;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2022-09-27 11:52:49 +02:00
|
|
|
/**
|
|
|
|
* @return Collection<int, Niveau03>
|
|
|
|
*/
|
|
|
|
public function getNiveau03s(): Collection
|
|
|
|
{
|
|
|
|
return $this->niveau03s;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addNiveau03(Niveau03 $niveau03): self
|
|
|
|
{
|
|
|
|
if (!$this->niveau03s->contains($niveau03)) {
|
|
|
|
$this->niveau03s->add($niveau03);
|
|
|
|
$niveau03->setNiveau02($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeNiveau03(Niveau03 $niveau03): self
|
|
|
|
{
|
|
|
|
if ($this->niveau03s->removeElement($niveau03)) {
|
|
|
|
// set the owning side to null (unless already changed)
|
|
|
|
if ($niveau03->getNiveau02() === $this) {
|
|
|
|
$niveau03->setNiveau02(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2022-07-21 16:15:47 +02:00
|
|
|
/**
|
|
|
|
* @return Collection<int, Registration>
|
|
|
|
*/
|
|
|
|
public function getRegistrations(): Collection
|
|
|
|
{
|
|
|
|
return $this->registrations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addRegistration(Registration $registration): self
|
|
|
|
{
|
|
|
|
if (!$this->registrations->contains($registration)) {
|
2022-09-27 11:52:49 +02:00
|
|
|
$this->registrations->add($registration);
|
2022-07-21 16:15:47 +02:00
|
|
|
$registration->setNiveau02($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeRegistration(Registration $registration): self
|
|
|
|
{
|
|
|
|
if ($this->registrations->removeElement($registration)) {
|
|
|
|
// set the owning side to null (unless already changed)
|
|
|
|
if ($registration->getNiveau02() === $this) {
|
|
|
|
$registration->setNiveau02(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection<int, User>
|
|
|
|
*/
|
|
|
|
public function getUsers(): Collection
|
|
|
|
{
|
|
|
|
return $this->users;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addUser(User $user): self
|
|
|
|
{
|
|
|
|
if (!$this->users->contains($user)) {
|
2022-09-27 11:52:49 +02:00
|
|
|
$this->users->add($user);
|
2022-07-21 16:15:47 +02:00
|
|
|
$user->setNiveau02($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->getNiveau02() === $this) {
|
|
|
|
$user->setNiveau02(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|