<?php
namespace App\AppBundle\AdminBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="admin_user")
* @ORM\HasLifecycleCallbacks()
*/
class Admin_User implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $first_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $last_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $email;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $mobile;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $password;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dob;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $gender;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $password_change_date;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $login_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $login_code_start_timestamp;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $login_password_token;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $country_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $profile_pic_url;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
*/
private $active;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="Admin_Token", mappedBy="admin_user")
*/
private $admin_tokens;
/**
* @ORM\ManyToOne(targetEntity="Admin_Language")
* @ORM\JoinColumn(name="admin_language_id", referencedColumnName="id")
*/
private $admin_language;
// /**
// * @ORM\ManyToOne(targetEntity="Admin_Access_Role_Master")
// * @ORM\JoinColumn(name="admin_access_role_master_id", referencedColumnName="id")
// */
// private $admin_access_role_master;
/**
* @var Admin_Roles
* @ORM\OneToOne(targetEntity="Admin_Roles", mappedBy="admin_user")
*/
private $admin_roles;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* @param mixed $first_name
*/
public function setFirstName($first_name)
{
$this->first_name = $first_name;
}
/**
* @return mixed
*/
public function getLastName()
{
return $this->last_name;
}
/**
* @param mixed $last_name
*/
public function setLastName($last_name)
{
$this->last_name = $last_name;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getMobile()
{
return $this->mobile;
}
/**
* @param mixed $mobile
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
}
/**
* @return mixed
*/
public function getPassword()
{
return $this->password;
}
/**
* @param mixed $password
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* @return mixed
*/
public function getDob()
{
return $this->dob;
}
/**
* @param mixed $dob
*/
public function setDob($dob)
{
$this->dob = $dob;
}
/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}
/**
* @param mixed $gender
*/
public function setGender($gender)
{
$this->gender = $gender;
}
/**
* @return mixed
*/
public function getPasswordChangeDate()
{
return $this->password_change_date;
}
/**
* @param mixed $password_change_date
*/
public function setPasswordChangeDate($password_change_date)
{
$this->password_change_date = $password_change_date;
}
/**
* @return mixed
*/
public function getLoginCode()
{
return $this->login_code;
}
/**
* @param mixed $login_code
*/
public function setLoginCode($login_code)
{
$this->login_code = $login_code;
}
/**
* @return mixed
*/
public function getLoginCodeStartTimestamp()
{
return $this->login_code_start_timestamp;
}
/**
* @param mixed $login_code_start_timestamp
*/
public function setLoginCodeStartTimestamp($login_code_start_timestamp)
{
$this->login_code_start_timestamp = $login_code_start_timestamp;
}
/**
* @return mixed
*/
public function getLoginPasswordToken()
{
return $this->login_password_token;
}
/**
* @param mixed $login_password_token
*/
public function setLoginPasswordToken($login_password_token)
{
$this->login_password_token = $login_password_token;
}
/**
* @return mixed
*/
public function getCountryCode()
{
return $this->country_code;
}
/**
* @param mixed $country_code
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
}
/**
* @return mixed
*/
public function getProfilePicUrl()
{
return $this->profile_pic_url;
}
/**
* @param mixed $profile_pic_url
*/
public function setProfilePicUrl($profile_pic_url)
{
$this->profile_pic_url = $profile_pic_url;
}
/**
* @return mixed
*/
public function getActive()
{
return $this->active;
}
/**
* @param mixed $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getAdminTokens()
{
return $this->admin_tokens;
}
/**
* @param mixed $admin_tokens
*/
public function setAdminTokens($admin_tokens)
{
$this->admin_tokens = $admin_tokens;
}
/**
* @return mixed
*/
public function getAdminLanguage()
{
return $this->admin_language;
}
/**
* @param mixed $admin_language
*/
public function setAdminLanguage($admin_language)
{
$this->admin_language = $admin_language;
}
/**
* @return Admin_Roles
*/
public function getAdminRoles()
{
return $this->admin_roles;
}
/**
* @param Admin_Roles $admin_roles
*/
public function setAdminRoles(Admin_Roles $admin_roles)
{
$this->admin_roles = $admin_roles;
}
/**
* @var int
* @ORM\Column(type="integer", nullable=false)
*/
private $updatedBy = 0;
/**
* @var int
* @ORM\Column(type="integer", nullable=false)
*/
private $createdBy = 0;
/**
* @return int
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @param int $updatedBy
*/
public function setUpdatedBy(int $updatedBy)
{
$this->updatedBy = $updatedBy;
}
/**
* @return int
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @param int $createdBy
*/
public function setCreatedBy(int $createdBy)
{
$this->createdBy = $createdBy;
}
/**
* @var string $created
*
* @ORM\Column(name="created_at", type="string", nullable=false)
*/
protected $createdAt;
/**
* @var string $updated
*
* @ORM\Column(name="updated_at", type="string", nullable=false)
*/
protected $updatedAt;
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$this->setUpdatedAt(round(microtime(true) * 1000));
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}
public function __construct() {
$this->admin_tokens = new ArrayCollection();
$this->setCreatedAt(round(microtime(true) * 1000));
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'country_code' => $this->country_code,
'dob' => $this->dob,
'email' => $this->email,
'first_name' => $this->first_name,
'gender' => $this->gender,
'language' => $this->admin_language,
'last_name' => $this->last_name,
'mobile' => $this->mobile,
'profile_pic_url' => $this->profile_pic_url,
'active' => $this->active,
'admin_roles' => $this->admin_roles
);
}
}