<?php
namespace AdminBundle\Entity;
use Ramsey\Uuid\Uuid;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Sonata\UserBundle\Entity\BaseUser;
/**
* This file has been generated by the Sonata EasyExtends bundle.
*/
#[ORM\Table(name: 'user')]
#[ORM\Entity(repositoryClass: \AdminBundle\Repository\UserRepository::class)]
class User extends BaseUser
{
const ROLE_ADMIN = 'ROLE_ADMIN';
const ROLE_OPERATOR = 'ROLE_OPERATOR';
const ROLE_OPERATOR_ADMIN = 'ROLE_OPERATOR_ADMIN';
const ROLE_CLIENT = 'ROLE_CLIENT';
const ROLE_DRIVER = 'ROLE_DRIVER';
const ROLE_COMPANY = 'ROLE_COMPANY';
const ROLE_API = 'ROLE_API';
const BRAINTREE_CUSTOMER = 1;
const STRIPE_CUSTOMER = 5;
public const SYSTEM_USER_USERNAME = 'system@ctlf.co.uk';
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
protected $id;
/**
* Old FosUser columns - props -- start
*/
#[ORM\Column(name: 'two_step_code', type: 'string', nullable: true, length: 255)]
protected $twoStepVerificationCode;
#[ORM\Column(name: 'date_of_birth', type: 'datetime', nullable: true)]
protected $dateOfBirth;
#[ORM\Column(name: 'firstname', type: 'string', nullable: true, length: 64)]
protected $firstname;
#[ORM\Column(name: 'lastname', type: 'string', nullable: true, length: 64)]
protected $lastname;
#[ORM\Column(name: 'website', type: 'string', nullable: true, length: 64)]
protected $website;
#[ORM\Column(name: 'biography', type: 'string', nullable: true, length: 1000)]
protected $biography;
#[ORM\Column(name: 'gender', type: 'string', nullable: true, length: 1)]
protected $gender = null;
#[ORM\Column(name: 'locale', type: 'string', nullable: true, length: 8)]
protected $locale;
#[ORM\Column(name: 'timezone', type: 'string', nullable: true, length: 64)]
protected $timezone;
#[ORM\Column(name: 'phone', type: 'string', nullable: true, length: 64)]
protected $phone;
#[ORM\Column(name: 'facebook_uid', type: 'string', nullable: true, length: 255)]
protected $facebookUid;
#[ORM\Column(name: 'facebook_name', type: 'string', nullable: true, length: 255)]
protected $facebookName;
#[ORM\Column(name: 'facebook_data', type: 'json', nullable: true)]
protected $facebookData;
#[ORM\Column(name: 'twitter_uid', type: 'string', nullable: true, length: 255)]
protected $twitterUid;
#[ORM\Column(name: 'twitter_name', type: 'string', nullable: true, length: 255)]
protected $twitterName;
#[ORM\Column(name: 'twitter_data', type: 'json', nullable: true)]
protected $twitterData;
#[ORM\Column(name: 'gplus_uid', type: 'string', nullable: true, length: 255)]
protected $gplusUid;
#[ORM\Column(name: 'gplus_name', type: 'string', nullable: true, length: 255)]
protected $gplusName;
#[ORM\Column(name: 'gplus_data', type: 'json', nullable: true)]
protected $gplusData;
#[ORM\Column(name: 'token', type: 'string', nullable: true, length: 255)]
protected $token;
/**
* Old FosUser columns - props -- end
*/
/**
* @var Account
*/
#[ORM\OneToOne(targetEntity: \Account::class, mappedBy: 'user')]
private $account;
/**
* @var Company
*/
#[ORM\OneToOne(targetEntity: \AdminBundle\Entity\Company::class, mappedBy: 'user')]
private $company;
/**
* @var Driver
*/
#[ORM\OneToOne(targetEntity: \AdminBundle\Entity\Driver::class, mappedBy: 'user', cascade: ['persist'])]
private $driver;
/**
* @var string
*/
#[ORM\Column(name: 'api_key', type: 'string', length: 64, nullable: true, unique: true)]
protected $apiKey;
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\ChangeRequests::class, mappedBy: 'fromUser')]
private $changeRequests;
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\ClientChangeRequest::class, mappedBy: 'fromUser')]
private $clientChangeRequests;
/**
* @var string
*/
#[ORM\Column(name: 'allow_ips_to_login', type: 'text', nullable: true)]
private $allowIpsToLogin;
/**
* @var string
*/
#[ORM\Column(name: 'device_uid', type: 'string', length: 264, nullable: true, unique: false)]
protected $deviceUid;
/**
* @var string
*/
#[ORM\Column(name: 'device_xid', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceXid;
/**
* @var string
*/
#[ORM\Column(name: 'device_application_name', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceApplicationName;
/**
* @var string
*/
#[ORM\Column(name: 'device_application_version', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceApplicationVersion;
/**
* @var string
*/
#[ORM\Column(name: 'device_model', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceModel;
/**
* @var string
*/
#[ORM\Column(name: 'device_product', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceProduct;
/**
* @var string
*/
#[ORM\Column(name: 'device_type', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceType;
/**
* @var string
*/
#[ORM\Column(name: 'device_vendor', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceVendor;
/**
* @var string
*/
#[ORM\Column(name: 'device_os_api_version', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceOsApiVersion;
/**
* @var string
*/
#[ORM\Column(name: 'device_os_type', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceOsType;
/**
* @var string
*/
#[ORM\Column(name: 'device_os_version', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceOsVersion;
/**
* @var string
*/
#[ORM\Column(name: 'device_sandbox', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceSandbox;
/**
* @var string
*/
#[ORM\Column(name: 'device_screen_density', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceScreenDensity;
/**
* @var string
*/
#[ORM\Column(name: 'device_screen_height', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceScreenHeight;
/**
* @var string
*/
#[ORM\Column(name: 'device_screen_orientation', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceScreenOrientation;
/**
* @var string
*/
#[ORM\Column(name: 'device_screen_width', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceScreenWidth;
/**
* @var string
*/
#[ORM\Column(name: 'device_time_zone', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceTimeZone;
/**
* @var string
*/
#[ORM\Column(name: 'device_datetime', type: 'string', length: 64, nullable: true, unique: false)]
protected $deviceDatetime;
/**
* @var string
*/
#[ORM\Column(name: 'apple_uid', type: 'string', length: 100, nullable: true)]
protected $appleUid;
/**
* @var string
*/
#[ORM\Column(name: 'braintree_customer', type: 'string', length: 255, nullable: true)]
protected $braintreeCustomer;
/**
* @var string
*/
#[ORM\Column(name: 'stripe_customer', type: 'string', length: 255, nullable: true)]
protected $stripeCustomer;
/**
* @var int
*/
#[ORM\Column(name: 'review_rating', type: 'decimal', precision: 7, scale: 2, nullable: false, options: ['default' => 5])]
protected $reviewRating;
#[ORM\OneToMany(targetEntity: \Booking::class, mappedBy: 'clientUser')]
private $clientBookings;
public function __construct()
{
$this->reviewRating = 5;
$this->apiKey = str_replace('-', '', Uuid::uuid4());
}
/**
* Get id
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
/**
* @return Account
*/
public function getAccount()
{
return $this->account;
}
/**
* @param Account $account
* @return User
*/
public function setAccount(Account $account)
{
$this->account = $account;
return $this;
}
/**
* @return Company
*/
public function getCompany()
{
return $this->company;
}
/**
* @param Company $company
* @return User
*/
public function setCompany(Company $company)
{
$this->company = $company;
return $this;
}
/**
* @return Driver
*/
public function getDriver()
{
return $this->driver;
}
/**
* @param Driver $driver
* @return User
*/
public function setDriver(Driver $driver): User
{
$this->driver = $driver;
return $this;
}
/**
* @return string
*/
public function getApiKey()
{
return $this->apiKey;
}
/**
* @param string $apiKey
*/
public function setApiKey($apiKey)
{
$this->apiKey = $apiKey;
}
public function toArray()
{
return get_object_vars($this);
}
public function getFullname() {
return $this->getFirstname().' '.$this->getLastname();
}
public function __toString()
{
$string = $this->getFullname();
if ($this->getPhone()) {
$string .= ' - ' . $this->getPhone();
}
$string .= ' - ' . $this->getEmail();
return $string;
}
/**
* Add changeRequest
*
* @param \AdminBundle\Entity\ChangeRequests $changeRequest
*
* @return User
*/
public function addChangeRequest(\AdminBundle\Entity\ChangeRequests $changeRequest)
{
$this->changeRequests[] = $changeRequest;
return $this;
}
/**
* Remove changeRequest
*
* @param \AdminBundle\Entity\ChangeRequests $changeRequest
*/
public function removeChangeRequest(\AdminBundle\Entity\ChangeRequests $changeRequest)
{
$this->changeRequests->removeElement($changeRequest);
}
/**
* Get changeRequests
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChangeRequests()
{
return $this->changeRequests;
}
/**
* Add clientChangeRequest
*
* @param \AdminBundle\Entity\ClientChangeRequest $clientChangeRequests
*
* @return User
*/
public function addClientChangeRequest(\AdminBundle\Entity\ClientChangeRequest $clientChangeRequest)
{
$this->clientChangeRequests[] = $clientChangeRequest;
return $this;
}
/**
* Remove clientChangeRequest
*
* @param \AdminBundle\Entity\ClientChangeRequests $clientChangeRequest
*/
public function removeClientChangeRequest(\AdminBundle\Entity\ClientChangeRequest $clientChangeRequest)
{
$this->clientChangeRequests->removeElement($clientChangeRequest);
}
/**
* Get clientChangeRequest
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getClientChangeRequests()
{
return $this->clientChangeRequest;
}
/**
* @return string
*/
public function getAllowIpsToLogin()
{
return $this->allowIpsToLogin;
}
/**
* @param string $allowIpsToLogin
*/
public function setAllowIpsToLogin($allowIpsToLogin)
{
$this->allowIpsToLogin = $allowIpsToLogin;
}
public function getDeviceUid()
{
return $this->deviceUid;
}
public function getDeviceXid()
{
return $this->deviceXid;
}
public function getDeviceApplicationName()
{
return $this->deviceApplicationName;
}
public function getDeviceApplicationVersion()
{
return $this->deviceApplicationVersion;
}
public function getDeviceModel()
{
return $this->deviceModel;
}
public function getDeviceProduct()
{
return $this->deviceProduct;
}
public function getDeviceType()
{
return $this->deviceType;
}
public function getDeviceVendor()
{
return $this->deviceVendor;
}
public function getDeviceOsApiVersion()
{
return $this->deviceOsApiVersion;
}
public function getDeviceOsType()
{
return $this->deviceOsType;
}
public function getDeviceOsVersion()
{
return $this->deviceOsVersion;
}
public function getDeviceSandbox()
{
return $this->deviceSandbox;
}
public function getDeviceScreenDensity()
{
return $this->deviceScreenDensity;
}
public function getDeviceScreenHeight()
{
return $this->deviceScreenHeight;
}
public function getDeviceScreenOrientation()
{
return $this->deviceScreenOrientation;
}
public function getDeviceScreenWidth()
{
return $this->deviceScreenWidth;
}
public function getDeviceTimeZone()
{
return $this->deviceTimeZone;
}
public function getDeviceDatetime()
{
return $this->deviceDatetime;
}
public function setDeviceUid($deviceUid)
{
$this->deviceUid = $deviceUid;
}
public function setDeviceXid($deviceXid)
{
$this->deviceXid = $deviceXid;
}
public function setDeviceApplicationName($deviceApplicationName)
{
$this->deviceApplicationName = $deviceApplicationName;
}
public function setDeviceApplicationVersion($deviceApplicationVersion)
{
$this->deviceApplicationVersion = $deviceApplicationVersion;
}
public function setDeviceModel($deviceModel)
{
$this->deviceModel = $deviceModel;
}
public function setDeviceProduct($deviceProduct)
{
$this->deviceProduct = $deviceProduct;
}
public function setDeviceType($deviceType)
{
$this->deviceType = $deviceType;
}
public function setDeviceVendor($deviceVendor)
{
$this->deviceVendor = $deviceVendor;
}
public function setDeviceOsApiVersion($deviceOsApiVersion)
{
$this->deviceOsApiVersion = $deviceOsApiVersion;
}
public function setDeviceOsType($deviceOsType)
{
$this->deviceOsType = $deviceOsType;
}
public function setDeviceOsVersion($deviceOsVersion)
{
$this->deviceOsVersion = $deviceOsVersion;
}
public function setDeviceSandbox($device_sandbox)
{
$this->deviceSandbox = $device_sandbox;
}
public function setDeviceScreenDensity($device_screen_density)
{
$this->deviceScreenDensity = $device_screen_density;
}
public function setDeviceScreenHeight($deviceScreenHeight)
{
$this->deviceScreenHeight = $deviceScreenHeight;
}
public function setDeviceScreenOrientation($deviceScreenOrientation)
{
$this->deviceScreenOrientation = $deviceScreenOrientation;
}
public function setDeviceScreenWidth($deviceScreenWidth)
{
$this->deviceScreenWidth = $deviceScreenWidth;
}
public function setDeviceTimeZone($deviceTimeZone)
{
$this->deviceTimeZone = $deviceTimeZone;
}
public function setDeviceDatetime($deviceDatetime)
{
$this->deviceDatetime = $deviceDatetime;
}
/**
* @return string
*/
public function getAppleUid(): string
{
return $this->appleUid;
}
/**
* @param string $appleUid
*/
public function setAppleUid(string $appleUid)
{
$this->appleUid = $appleUid;
}
/**
* @return int
*/
public function getReviewRating()
{
return $this->reviewRating;
}
/**
* @param float $reviewRating
*
* @return User
*/
public function setReviewRating($reviewRating)
{
$this->reviewRating = $reviewRating;
return $this;
}
/**
* @return string
*/
public function getBraintreeCustomer()
{
return $this->braintreeCustomer;
}
/**
* @param string $braintreeCustomer
*/
public function setBraintreeCustomer($braintreeCustomer)
{
$this->braintreeCustomer = $braintreeCustomer;
}
/**
* @return string
*/
public function getStripeCustomer()
{
return $this->stripeCustomer;
}
/**
* @param string $stripeCustomer
*/
public function setStripeCustomer($stripeCustomer)
{
$this->stripeCustomer = $stripeCustomer;
}
/**
* @return ArrayCollection
*/
public function getClientBookings()
{
return $this->clientBookings;
}
/**
* @param Booking $bookings
*/
public function setBookings(ArrayCollection $clientBookings)
{
$this->clientBookings = $clientBookings;
return $this;
}
/**
* Get userHistory
*
* @return Array
*/
public static function getUserHistory()
{
return [];
}
/**
* Old FosUser columns - methods -- start
*/
public function setTwoStepVerificationCode($twoStepVerificationCode) {
$this->twoStepVerificationCode = $twoStepVerificationCode;
return $this;
}
public function getTwoStepVerificationCode() {
return $this->twoStepVerificationCode;
}
public function setBiography($biography) {
$this->biography = $biography;
return $this;
}
public function getBiography() {
return $this->biography;
}
public function setDateOfBirth($dateOfBirth) {
$this->dateOfBirth = $dateOfBirth;
return $this;
}
public function getDateOfBirth() {
return $this->dateOfBirth;
}
public function setFacebookData($facebookData) {
$this->facebookData = $facebookData;
return $this;
}
public function getFacebookData() {
return $this->facebookData;
}
public function setFacebookName($facebookName) {
$this->facebookName = $facebookName;
return $this;
}
public function getFacebookName() {
return $this->facebookName;
}
public function setFacebookUid($facebookUid) {
$this->facebookUid = $facebookUid;
return $this;
}
public function getFacebookUid() {
return $this->facebookUid;
}
public function setFirstname($firstname) {
$this->firstname = $firstname;
return $this;
}
public function getFirstname() {
return $this->firstname;
}
public function setGender($gender) {
$this->gender = $gender;
return $this;
}
public function getGender() {
return $this->gender;
}
public function setGplusData($gplusData) {
$this->gplusData = $gplusData;
return $this;
}
public function getGplusData() {
return $this->gplusData;
}
public function setGplusName($gplusName) {
$this->gplusName = $gplusName;
return $this;
}
public function getGplusName() {
return $this->gplusName;
}
public function setGplusUid($gplusUid) {
$this->gplusUid = $gplusUid;
return $this;
}
public function getGplusUid() {
return $this->gplusUid;
}
public function setLastname($lastname) {
$this->lastname = $lastname;
return $this;
}
public function getLastname() {
return $this->lastname;
}
public function setLocale($locale) {
$this->locale = $locale;
return $this;
}
public function getLocale() {
return $this->locale;
}
public function setPhone($phone) {
$this->phone = $phone;
return $this;
}
public function getPhone() {
return $this->phone;
}
public function setTimezone($timezone) {
$this->timezone = $timezone;
return $this;
}
public function getTimezone() {
return $this->timezone;
}
public function setTwitterData($twitterData) {
$this->twitterData = $twitterData;
return $this;
}
public function getTwitterData() {
return $this->twitterData;
}
public function setTwitterName($twitterName) {
$this->twitterName = $twitterName;
return $this;
}
public function getTwitterName() {
return $this->twitterName;
}
public function setTwitterUid($twitterUid) {
$this->twitterUid = $twitterUid;
return $this;
}
public function getTwitterUid() {
return $this->twitterUid;
}
public function setWebsite($website) {
$this->website = $website;
return $this;
}
public function getWebsite() {
return $this->website;
}
public function setToken($token) {
$this->token = $token;
return $this;
}
public function getToken() {
return $this->token;
}
/**
* Old FosUser columns - methods -- end
*/
}