<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\BFInscriptionUserRepository")
*/
class BFInscriptionUser extends AbstractArrayAccess
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="App\Entity\BFUser", inversedBy="inscriptionuser", cascade={"persist"})
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $user;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $forname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $telephonenumber;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $licencenumber;
/**
* @ORM\Column(type="datetime")
*/
private $creationdate;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser1", orphanRemoval=true)
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions1;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser2")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions2;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser3")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions3;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser4")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions4;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser5")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions5;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BFInscription", mappedBy="inscriptionuser6")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $inscriptions6;
public function __construct()
{
$this->inscriptions1 = new ArrayCollection();
$this->inscriptions2 = new ArrayCollection();
$this->inscriptions3 = new ArrayCollection();
$this->inscriptions4 = new ArrayCollection();
$this->inscriptions5 = new ArrayCollection();
$this->inscriptions6 = new ArrayCollection();
$this->creationdate= new \DateTime();
}
public function Copy():BFInscriptionUser
{
$copy = new BFInscriptionUser();
$copy->setUser($this->user);
$copy->setName($this->name);
$copy->setForname($this->forname);
$copy->setTelephonenumber($this->telephonenumber);
$copy->setLicencenumber($this->licencenumber);
return $copy;
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?BFUser
{
return $this->user;
}
public function setUser(?BFUser $user): self
{
$this->user = $user;
if($user!=null)
{
$userdescription = $user->getDescription();
if($userdescription->getName())
$this->name = $userdescription->getName();
if($userdescription->getForname())
$this->forname= $userdescription->getForname();
$this->email = $user->getEmail();
$this->telephonenumber = $userdescription->getPhonenumber();
$this->licencenumber=$userdescription->getLicencenumber();
}
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getForname(): ?string
{
return $this->forname;
}
public function setForname(string $forname): self
{
$this->forname = $forname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getTelephonenumber(): ?string
{
return $this->telephonenumber;
}
public function setTelephonenumber(?string $telephonenumber): self
{
$this->telephonenumber = $telephonenumber;
return $this;
}
public function getLicencenumber(): ?int
{
return $this->licencenumber;
}
public function setLicencenumber(?int $licencenumber): self
{
$this->licencenumber = $licencenumber;
return $this;
}
public function getCreationdate(): ?\DateTimeInterface
{
return $this->creationdate;
}
public function setCreationdate(\DateTimeInterface $creationdate): self
{
$this->creationdate = $creationdate;
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions1(): Collection
{
return $this->inscriptions1;
}
public function addInscriptions1(BFInscription $inscriptions1): self
{
if (!$this->inscriptions->contains($inscriptions1)) {
$this->inscriptions1[] = $inscriptions1;
$inscriptions1->setInscriptionuser1($this);
}
return $this;
}
public function removeInscriptions1(BFInscription $inscriptions1): self
{
if ($this->inscriptions1->contains($inscriptions1)) {
$this->inscriptions1->removeElement($inscriptions1);
// set the owning side to null (unless already changed)
if ($inscriptions1->getInscriptionuser1() === $this) {
$inscriptions1->setInscriptionuser1(null);
}
}
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions2(): Collection
{
return $this->inscriptions2;
}
public function addInscriptions2(BFInscription $inscriptions2): self
{
if (!$this->inscriptions2->contains($inscriptions2)) {
$this->inscriptions2[] = $inscriptions2;
$inscriptions2->setInscriptionuser2($this);
}
return $this;
}
public function removeInscriptions2(BFInscription $inscriptions2): self
{
if ($this->inscriptions2->contains($inscriptions2)) {
$this->inscriptions2->removeElement($inscriptions2);
// set the owning side to null (unless already changed)
if ($inscriptions2->getInscriptionuser2() === $this) {
$inscriptions2->setInscriptionuser2(null);
}
}
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions3(): Collection
{
return $this->inscriptions3;
}
public function addInscriptions3(BFInscription $inscriptions3): self
{
if (!$this->inscriptions3->contains($inscriptions3)) {
$this->inscriptions3[] = $inscriptions3;
$inscriptions3->setInscriptionuser3($this);
}
return $this;
}
public function removeInscriptions3(BFInscription $inscriptions3): self
{
if ($this->inscriptions3->contains($inscriptions3)) {
$this->inscriptions3->removeElement($inscriptions3);
// set the owning side to null (unless already changed)
if ($inscriptions3->getInscriptionuser3() === $this) {
$inscriptions3->setInscriptionuser3(null);
}
}
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions4(): Collection
{
return $this->inscriptions4;
}
public function addInscriptions4(BFInscription $inscriptions4): self
{
if (!$this->inscriptions4->contains($inscriptions4)) {
$this->inscriptions4[] = $inscriptions4;
$inscriptions4->setInscriptionuser4($this);
}
return $this;
}
public function removeInscriptions4(BFInscription $inscriptions4): self
{
if ($this->inscriptions4->contains($inscriptions4)) {
$this->inscriptions4->removeElement($inscriptions4);
// set the owning side to null (unless already changed)
if ($inscriptions4->getInscriptionuser4() === $this) {
$inscriptions4->setInscriptionuser4(null);
}
}
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions5(): Collection
{
return $this->inscriptions5;
}
public function addInscriptions5(BFInscription $inscriptions5): self
{
if (!$this->inscriptions5->contains($inscriptions5)) {
$this->inscriptions5[] = $inscriptions5;
$inscriptions5->setInscriptionuser5($this);
}
return $this;
}
public function removeInscriptions5(BFInscription $inscriptions5): self
{
if ($this->inscriptions5->contains($inscriptions5)) {
$this->inscriptions5->removeElement($inscriptions5);
// set the owning side to null (unless already changed)
if ($inscriptions5->getInscriptionuser5() === $this) {
$inscriptions5->setInscriptionuser5(null);
}
}
return $this;
}
/**
* @return Collection|BFInscription[]
*/
public function getInscriptions6(): Collection
{
return $this->inscriptions6;
}
public function addInscriptions6(BFInscription $inscriptions6): self
{
if (!$this->inscriptions6->contains($inscriptions6)) {
$this->inscriptions6[] = $inscriptions6;
$inscriptions6->setInscriptionuser6($this);
}
return $this;
}
public function removeInscriptions6(BFInscription $inscriptions6): self
{
if ($this->inscriptions6->contains($inscriptions6)) {
$this->inscriptions6->removeElement($inscriptions6);
// set the owning side to null (unless already changed)
if ($inscriptions6->getInscriptionuser6() === $this) {
$inscriptions6->setInscriptionuser6(null);
}
}
return $this;
}
public function getAllInscriptions()
{
$inscriptionscollections = new ArrayCollection();
if($this->inscriptions1!=null)
$inscriptionscollections->add($this->inscriptions1);
if($this->inscriptions2!=null)
$inscriptionscollections->add($this->inscriptions2);
if($this->inscriptions3!=null)
$inscriptionscollections->add($this->inscriptions3);
if($this->inscriptions4!=null)
$inscriptionscollections->add($this->inscriptions4);
if($this->inscriptions5!=null)
$inscriptionscollections->add($this->inscriptions5);
if($this->inscriptions6!=null)
$inscriptionscollections->add($this->inscriptions6);
$inscriptions = new ArrayCollection();
foreach($inscriptionscollections as $inscriptioncollection)
{
foreach($inscriptioncollection as $inscription)
{
$inscriptions->add($inscription);
}
}
return $inscriptions;
}
public function UpdateDate()
{
if($this->creationdate==null)
$this->creationdate = new \DateTime();
}
public function IsValid()
{
return $this->name!=null && $this->forname!=null;
}
//for twig
public function getIsValid()
{
return $this->IsValid();
}
}