nineskeletor/src/Entity/Niveau04.php

268 lines
5.5 KiB
PHP

<?php
namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @ORM\Table(name="niveau04")
* @ORM\HasLifecycleCallbacks()
* @ORM\Entity(repositoryClass="App\Repository\Niveau04Repository")
*
* @UniqueEntity(fields="label", message="Un Niveau de rang 4 existe déjà avec ce label")
*/
class Niveau04
{
/**
* @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;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $code;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $postaladress;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
private $telephonenumber;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string")
*/
private $apikey;
/**
* @ORM\ManyToOne(targetEntity="Niveau03", inversedBy="niveau04s")
* @ORM\JoinColumn(nullable=false)
*/
private $niveau03;
/**
* @var ArrayCollection
* @var Registration
*
* @ORM\OneToMany(targetEntity="Registration", mappedBy="niveau04", cascade={"persist"}, orphanRemoval=false)
*/
private $registrations;
/**
* @var ArrayCollection
* @var User
*
* @ORM\OneToMany(targetEntity="User", mappedBy="niveau04", cascade={"persist"}, orphanRemoval=false)
*/
private $users;
// == CODE A NE PAS REGENERER
private $niveau01;
public function getNiveau01(): ?Niveau01
{
return $this->niveau03 ? $this->niveau03->getNiveau02()->getNiveau01() : null;
}
public function setNiveau01(?Niveau01 $niveau01): self
{
$this->niveau01 = $niveau01;
return $this;
}
private $niveau02;
public function getNiveau02(): ?Niveau02
{
return $this->niveau03 ? $this->niveau03->getNiveau02() : null;
}
public function setNiveau02(?Niveau02 $niveau02): self
{
$this->niveau02 = $niveau02;
return $this;
}
// ==
public function __construct()
{
$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 getNiveau03(): ?Niveau03
{
return $this->niveau03;
}
public function setNiveau03(?Niveau03 $niveau03): self
{
$this->niveau03 = $niveau03;
return $this;
}
/**
* @return Collection<int, Registration>
*/
public function getRegistrations(): Collection
{
return $this->registrations;
}
public function addRegistration(Registration $registration): self
{
if (!$this->registrations->contains($registration)) {
$this->registrations->add($registration);
$registration->setNiveau04($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->getNiveau04() === $this) {
$registration->setNiveau04(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)) {
$this->users->add($user);
$user->setNiveau04($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->getNiveau04() === $this) {
$user->setNiveau04(null);
}
}
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getPostaladress(): ?string
{
return $this->postaladress;
}
public function setPostaladress(?string $postaladress): self
{
$this->postaladress = $postaladress;
return $this;
}
public function getTelephonenumber(): ?string
{
return $this->telephonenumber;
}
public function setTelephonenumber(?string $telephonenumber): self
{
$this->telephonenumber = $telephonenumber;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
}