<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ARSHDF\UserBundle\Entity\User as UserBundle;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @ORM\Table(name="`user`")
*/
class User extends UserBundle
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $place;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $direction;
/**
* @ORM\ManyToOne(targetEntity=GestSite::class, inversedBy="users")
*/
private $site;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $tempo_user;
/**
* @ORM\OneToMany(targetEntity=Evenement::class, mappedBy="placeAppartientAgent")
*/
private $evenements;
/**
* @ORM\OneToMany(targetEntity=Evenement::class, mappedBy="reserveParAgent")
*/
private $reservePar;
/**
* @ORM\OneToMany(targetEntity=Alerte::class, mappedBy="user")
*/
private $alertes;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mail_perso;
public function __construct()
{
parent::__construct();
$this->evenements = new ArrayCollection();
$this->reservePar = new ArrayCollection();
$this->alertes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPlace(): ?string
{
return $this->place;
}
public function setPlace(?string $place): self
{
$this->place = $place;
return $this;
}
public function getDirection(): ?string
{
return $this->direction;
}
public function setDirection(?string $direction): self
{
$this->direction = $direction;
return $this;
}
public function getSite(): ?GestSite
{
return $this->site;
}
public function setSite(?GestSite $site): self
{
$this->site = $site;
return $this;
}
public function getTempoUser(): ?int
{
return $this->tempo_user;
}
public function setTempoUser(?int $tempo_user): self
{
$this->tempo_user = $tempo_user;
return $this;
}
/**
* @return Collection<int, Evenement>
*/
public function getEvenements(): Collection
{
return $this->evenements;
}
public function addEvenement(Evenement $evenement): self
{
if (!$this->evenements->contains($evenement)) {
$this->evenements[] = $evenement;
$evenement->setPlaceAppartientAgent($this);
}
return $this;
}
public function removeEvenement(Evenement $evenement): self
{
if ($this->evenements->removeElement($evenement)) {
// set the owning side to null (unless already changed)
if ($evenement->getPlaceAppartientAgent() === $this) {
$evenement->setPlaceAppartientAgent(null);
}
}
return $this;
}
/**
* @return Collection<int, Evenement>
*/
public function getReservePar(): Collection
{
return $this->reservePar;
}
public function addReservePar(Evenement $reservePar): self
{
if (!$this->reservePar->contains($reservePar)) {
$this->reservePar[] = $reservePar;
$reservePar->setReserveParAgent($this);
}
return $this;
}
public function removeReservePar(Evenement $reservePar): self
{
if ($this->reservePar->removeElement($reservePar)) {
// set the owning side to null (unless already changed)
if ($reservePar->getReserveParAgent() === $this) {
$reservePar->setReserveParAgent(null);
}
}
return $this;
}
/**
* @return Collection<int, Alerte>
*/
public function getAlertes(): Collection
{
return $this->alertes;
}
public function addAlerte(Alerte $alerte): self
{
if (!$this->alertes->contains($alerte)) {
$this->alertes[] = $alerte;
$alerte->setUser($this);
}
return $this;
}
public function removeAlerte(Alerte $alerte): self
{
if ($this->alertes->removeElement($alerte)) {
// set the owning side to null (unless already changed)
if ($alerte->getUser() === $this) {
$alerte->setUser(null);
}
}
return $this;
}
public function display(){
return $this->getNom().' '.substr($this->getPrenom(),0,1).'. ('.$this->place.')';
}
public function identite(){
return $this->getNom().' '.$this->getPrenom();
}
public function getMailPerso(): ?string
{
return $this->mail_perso;
}
public function setMailPerso(?string $mail_perso): self
{
$this->mail_perso = $mail_perso;
return $this;
}
}