<?php
/**
* Created by Mediterranean Develup Solutions.
* User: jorge.defreitas@develup.solutions
* Date: 14/06/2017
* Time: 16:51
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* User
*
* @ORM\Table(name="users")
* @ORM\Entity
* @UniqueEntity("username")
* @UniqueEntity("email")
* @ORM\HasLifecycleCallbacks()
*/
class User implements UserInterface{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(name="picture", type="string", length=255, nullable=true)
*
*/
private $picture;
/**
* @ORM\Column(name="username", type="string", length=255, unique=true)
* @Assert\NotBlank()
*/
private $username;
/**
* @ORM\Column(name="email", type="string", length=255, unique=true)
* @Assert\NotBlank()
* @Assert\Email()
*/
private $email;
/**
* @ORM\Column(name="password", type="string", length=64)
*/
private $password;
/**
* @ORM\Column(name="name", type="string", length=255)
* @Assert\NotBlank()
*/
private $name;
/**
* @ORM\Column(name="last_name", type="string", length=255)
* @Assert\NotBlank()
*/
private $lastname;
/**
* @ORM\Column(name="telephone", type="string", length=255, nullable=true)
*/
private $telephone;
/**
* @ORM\Column(name="mobile", type="string", length=255, nullable=true)
*/
private $mobile;
/**
* @ORM\Column(name="status", type="boolean")
*/
private $status;
/**
* @ORM\Column(name="id_user_rol", type="integer", length=11, nullable=true)
*
*/
private $userrol;
/**
* @ORM\Column(name="id_team", type="integer", length=11, nullable=true)
*/
private $team;
/**
* @ORM\Column(name="role", type="string", length=50)
*/
private $role;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $accessKey;
/**
* @var string
* @ORM\Column(name="language", type="string", length=11, nullable=true)
*/
private $language;
/**
* @var \Datetime
*
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var \Datetime
*
* @ORM\Column(name="updated_at", type="datetime")
*/
private $updatedAt;
/**
* @ORM\Column(name="phone_sidebar", type="boolean")
*/
private $phoneSidebar;
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
}
public function getEmail()
{
return $this->email;
}
public function setEmail($email)
{
$this->email = $email;
}
public function getUsername()
{
return $this->username;
}
public function setUsername($username)
{
$this->username = $username;
}
public function getPassword()
{
return $this->password;
}
public function setPassword($password)
{
$this->password = $password;
}
public function getSalt()
{
// The bcrypt algorithm doesn't require a separate salt.
// You *may* need a real salt if you choose a different encoder.
//return null;
}
public function eraseCredentials()
{
}
public function getRole()
{
return $this->role;
}
public function setRole($role = null)
{
$this->role = $role;
}
public function getRoles()
{
return [$this->getRole()];
}
public function getAccessKey()
{
return $this->accessKey;
}
public function setAccessKey($accessKey = null)
{
$this->accessKey = $accessKey;
}
/**
* Set createdAt
*
* @param \Datetime $createdAt
*
* @return User
*/
public function setCreatedAt(\Datetime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \Datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \Datetime $updatedAt
*
* @return User
*/
public function setUpdatedAt(\Datetime $updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \Datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->createdAt = new \Datetime();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new \Datetime();
}
/**
* Set picture
*
* @param string $picture
*
* @return User
*/
public function setPicture($picture)
{
$this->picture = $picture;
return $this;
}
/**
* Get picture
*
* @return string
*/
public function getPicture()
{
return $this->picture;
}
/**
* Set name
*
* @param string $name
*
* @return User
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set lastname
*
* @param string $lastname
*
* @return User
*/
public function setLastname($lastname)
{
$this->lastname = $lastname;
return $this;
}
/**
* Get lastname
*
* @return string
*/
public function getLastname()
{
return $this->lastname;
}
/**
* Set telephone
*
* @param string $telephone
*
* @return User
*/
public function setTelephone($telephone)
{
$this->telephone = $telephone;
return $this;
}
/**
* Get telephone
*
* @return string
*/
public function getTelephone()
{
return $this->telephone;
}
/**
* Set mobile
*
* @param string $mobile
*
* @return User
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
return $this;
}
/**
* Get mobile
*
* @return string
*/
public function getMobile()
{
return $this->mobile;
}
/**
* Set status
*
* @param boolean $status
*
* @return User
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return boolean
*/
public function getStatus()
{
return $this->status;
}
/**
* Set userrol
*
* @param integer $userrol
*
* @return User
*/
public function setUserrol($userrol)
{
$this->userrol = $userrol;
return $this;
}
/**
* Get userrol
*
* @return integer
*/
public function getUserrol()
{
return $this->userrol;
}
/**
* Set team
*
* @param integer $team
*
* @return User
*/
public function setTeam($team)
{
$this->team = $team;
return $this;
}
/**
* Get team
*
* @return integer
*/
public function getTeam()
{
return $this->team;
}
/**
* Set language
*
* @param string $language
*
* @return User
*/
public function setLanguage($language)
{
$this->language = $language;
return $this;
}
/**
* Get language
*
* @return string
*/
public function getLanguage()
{
return $this->language;
}
/**
* Set phoneSidebar
*
* @param boolean $phoneSidebar
*
* @return User
*/
public function setPhoneSidebar($phoneSidebar)
{
$this->phoneSidebar = $phoneSidebar;
return $this;
}
/**
* Get phoneSidebar
*
* @return boolean
*/
public function getPhoneSidebar()
{
return $this->phoneSidebar;
}
}