<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\MaxDepth;
/**
* Admin
*
* @ORM\Table(name="admin", options={"collate"="latin1_general_ci","charset"="latin1"})
* @ORM\Entity(repositoryClass="App\Repository\AdminRepository")
* @ExclusionPolicy("all")
*/
class Admin implements UserInterface {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @Expose
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="datefr", type="date", nullable=false)
*/
private $datefr;
/**
* @var string
*
* @ORM\Column(name="user", type="string", length=11, nullable=false)
*/
private $user;
/**
* @var string
*
* @ORM\Column(name="password", type="string", length=11, nullable=false)
*/
private $password;
/**
* @var string
*
* @ORM\Column(name="famille", type="string", length=20, nullable=false)
*/
private $famille;
/**
* @var string
*
* @ORM\Column(name="contact", type="string", length=100, nullable=false)
* @Expose
*/
private $contact;
/**
* @var \DateTime
*
* @ORM\Column(name="ddn", type="date", nullable=false)
*/
private $ddn;
/**
* @var string
*
* @ORM\Column(name="adresse", type="string", length=150, nullable=false)
*/
private $adresse;
/**
* @var string
*
* @ORM\Column(name="cp", type="string", length=10, nullable=false)
*/
private $cp;
/**
* @var string
*
* @ORM\Column(name="ville", type="string", length=100, nullable=false)
*/
private $ville;
/**
* @var string
*
* @ORM\Column(name="tel", type="string", length=30, nullable=false)
*/
private $tel;
/**
* @var string
*
* @ORM\Column(name="mobile", type="string", length=30, nullable=false)
*/
private $mobile;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=150, nullable=false)
*/
private $email;
/**
* @var float
*
* @ORM\Column(name="commission", type="decimal", nullable=false, precision=8, scale=2)
*/
private $commission;
/**
* @var boolean
*
* @ORM\Column(name="valide", type="boolean", nullable=false)
*/
private $valide;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Client", mappedBy="idadmin")
*/
private $clients;
public function __toString() {
return $this->contact;
}
/**
* Get id
*
* @return integer
*/
public function getId() {
return $this->id;
}
/**
* Set datefr
*
* @param \DateTime $datefr
* @return Admin
*/
public function setDatefr($datefr) {
$this->datefr = $datefr;
return $this;
}
/**
* Get datefr
*
* @return \DateTime
*/
public function getDatefr() {
return $this->datefr;
}
/**
* Set user
*
* @param string $user
* @return Admin
*/
public function setUser($user) {
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return string
*/
public function getUser() {
return $this->user;
}
/**
* Set password
*
* @param string $password
* @return Admin
*/
public function setPassword($password) {
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword() {
return $this->password;
}
/**
* Set famille
*
* @param string $famille
* @return Admin
*/
public function setFamille($famille) {
$this->famille = $famille;
return $this;
}
/**
* Get famille
*
* @return string
*/
public function getFamille() {
return $this->famille;
}
/**
* Set contact
*
* @param string $contact
* @return Admin
*/
public function setContact($contact) {
$this->contact = $contact;
return $this;
}
/**
* Get contact
*
* @return string
*/
public function getContact() {
return $this->contact;
}
/**
* Set ddn
*
* @param \DateTime $ddn
* @return Admin
*/
public function setDdn($ddn) {
$this->ddn = $ddn;
return $this;
}
/**
* Get ddn
*
* @return \DateTime
*/
public function getDdn() {
return $this->ddn;
}
/**
* Set adresse
*
* @param string $adresse
* @return Admin
*/
public function setAdresse($adresse) {
$this->adresse = $adresse;
return $this;
}
/**
* Get adresse
*
* @return string
*/
public function getAdresse() {
return $this->adresse;
}
/**
* Set cp
*
* @param string $cp
* @return Admin
*/
public function setCp($cp) {
$this->cp = $cp;
return $this;
}
/**
* Get cp
*
* @return string
*/
public function getCp() {
return $this->cp;
}
/**
* Set ville
*
* @param string $ville
* @return Admin
*/
public function setVille($ville) {
$this->ville = $ville;
return $this;
}
/**
* Get ville
*
* @return string
*/
public function getVille() {
return $this->ville;
}
/**
* Set tel
*
* @param string $tel
* @return Admin
*/
public function setTel($tel) {
$this->tel = $tel;
return $this;
}
/**
* Get tel
*
* @return string
*/
public function getTel() {
return $this->tel;
}
/**
* Set mobile
*
* @param string $mobile
* @return Admin
*/
public function setMobile($mobile) {
$this->mobile = $mobile;
return $this;
}
/**
* Get mobile
*
* @return string
*/
public function getMobile() {
return $this->mobile;
}
/**
* Set email
*
* @param string $email
* @return Admin
*/
public function setEmail($email) {
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail() {
return $this->email;
}
/**
* Set commission
*
* @param float $commission
* @return Admin
*/
public function setCommission($commission) {
$this->commission = $commission;
return $this;
}
/**
* Get commission
*
* @return float
*/
public function getCommission() {
return $this->commission;
}
/**
* Set valide
*
* @param boolean $valide
* @return Admin
*/
public function setValide($valide) {
$this->valide = $valide;
return $this;
}
/**
* Get valide
*
* @return boolean
*/
public function getValide() {
return $this->valide;
}
/**
* Get username
*
* @return string
*/
public function getUsername() {
return $this->user;
}
/**
* Get roles
*
* @return array
*/
public function getRoles() {
if ($this->valide == 1)
{
$roles = array('ROLE_USER');
if ($this->famille == 'Commercial')
$roles[] = 'ROLE_COMMERCIAL';
else if ($this->famille == 'Admin')
$roles[] = 'ROLE_ADMIN';
return $roles;
}
else
return array();
}
/**
* Get salt
*
* @return string
*/
public function getSalt() {
return '';
}
/**
* eraseCredentials
*
* @return string
*/
public function eraseCredentials() {
return '';
}
}