<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Util\UUIDGeneratorUtil;
/**
* OmtClient
* @ORM\Table(name="omt_client")
* @ORM\Entity(repositoryClass="App\Repository\OmtClientRepository")
* @ORM\HasLifecycleCallbacks
*/
class OmtClient {
/**
* @var guid
* @ORM\Column(name="oc_id", type="guid")
* @ORM\Id
* @ORM\GeneratedValue(strategy="NONE")
*/
private $id;
/**
* @var string
* @ORM\Column(name="oc_name", type="string", nullable=true)
*/
private $name;
/**
* @var string
* @ORM\Column(name="oc_last_name", type="string", nullable=true)
*/
private $lastname;
/**
* @var string
* @ORM\Column(name="oc_email", type="string", length=100, nullable=true)
*/
private $email;
/**
* @var string
* @ORM\Column(name="oc_username", type="string", nullable=true)
*/
private $username;
/**
* @var \DateTime
* @ORM\Column(name="oc_birthdate", type="datetime", nullable=true)
*/
private $birthdate;
/**
* @var integer
* @ORM\Column(name="oc_phone", type="bigint", nullable=true, unique=true)
*/
private $phone;
/**
* @var integer
* @ORM\Column(name="oc_phone_2", type="string", length=15, nullable=true)
*/
private $phone_2;
/**
* @var integer
* @ORM\Column(name="oc_is_created_card", type="integer", nullable=true)
*/
private $isCreatedCard;
/**
* @var string
* @ORM\Column(name="oc_lang_code", type="string", nullable=true)
*/
private $langCode;
/**
* @var string
* @ORM\Column(name="oc_omt_user_id", type="string", nullable=true, unique=true)
*/
private $omtUserId;
/**
* @var string
* @ORM\Column(name="oc_user_phone_order", type="string", nullable=true)
*/
private $userPhoneOrder;
/**
* @var string
* @ORM\Column(name="oc_omt_username", type="string", nullable=true)
*/
private $omtUserUsername;
/**
* @var string
* @ORM\Column(name="oc_temporal_omt_pass", type="string", nullable=true)
*/
private $temporalOMTPass;
/**
* @var string
* @ORM\Column(name="oc_company_name", type="string", nullable=true)
*/
private $companyName;
/**
* @var int
* @ORM\Column(name="oc_default_email", type="integer", nullable=true, options={"default":"0"})
*/
private $defaultEmail = 0;
/**
* @var string
* @ORM\Column(name="oc_phone_verification_id", type="string", nullable=true)
*/
private $phoneVerificationId;
/**
* @var string
* @ORM\Column(name="oc_is_phone_verified", type="integer", nullable=true, options={"default":"0"})
*/
private $isPhoneVerified = 0;
/**
* @var string
* @ORM\Column(name="oc_already_reset", type="boolean", nullable=true, options={"default":false})
*/
private $alreadyReset = false;
/**
* @var string
* @ORM\Column(name="oc_global_checking", type="integer", nullable=true, options={"default":"0"})
*/
private $globalChecking = 0;
/**
* @var \DateTime
* @ORM\Column(name="oc_joined_date", type="datetime", nullable=true)
*/
private $joinedAt;
/**
* @var \DateTime
* @ORM\Column(name="oc_last_checking", type="datetime", nullable=true)
*/
private $lastChecking;
/**
* @var \DateTime
* @ORM\Column(name="oc_record_created_at", type="datetime", nullable=true)
*/
private $recordCreatedAt;
/**
* @var \DateTime
* @ORM\Column(name="oc_date_created", type="datetime", nullable=true)
*/
private $dateCreated;
/**
* @var boolean
* @ORM\Column(name="oc_discart_client", type="boolean", nullable=true, options={"default"=false})
*/
private $discartClient = false;
/**
* @var boolean
* @ORM\Column(name="oc_from_portal", type="boolean", nullable=true, options={"default"=false})
*/
private $fromPortal = false;
/**
* @return type
*/
public function getPhoneVerificationId() {
return $this->phoneVerificationId;
}
/**
* @param type $isPhoneVerified
*/
public function setPhoneVerificationId($phoneVerificationId) {
$this->phoneVerificationId = $phoneVerificationId;
}
/**
* @return type
*/
public function getIsPhoneVerified() {
return $this->isPhoneVerified;
}
/**
* @param type $isPhoneVerified
*/
public function setIsPhoneVerified($isPhoneVerified) {
$this->isPhoneVerified = $isPhoneVerified;
}
/**
* @return type
*/
public function getDefaultEmail() {
return $this->defaultEmail;
}
/**
* @param type $companyName
*/
public function setDefaultEmail($defaultEmail) {
$this->defaultEmail = $defaultEmail;
}
/**
* @return type
*/
public function getCompanyName() {
return $this->companyName;
}
/**
* @param type $companyName
*/
public function setCompanyName($companyName) {
$this->companyName = $companyName;
}
/**
* @return type
*/
public function getUserPhoneOrder() {
return $this->userPhoneOrder;
}
/**
* @param type $userPhoneOrder
*/
public function setUserPhoneOrder($userPhoneOrder) {
$this->userPhoneOrder = $userPhoneOrder;
}
/**
* @return type
*/
public function getTemporalOMTPass() {
return $this->temporalOMTPass;
}
/**
* @param type $temporalOMTPass
*/
public function setTemporalOMTPass($temporalOMTPass) {
$this->temporalOMTPass = $temporalOMTPass;
}
/**
* @return type
*/
public function getOmtUserId() {
return $this->omtUserId;
}
/**
* @return type
*/
public function getOmtUserUsername() {
return $this->omtUserUsername;
}
/**
* @param type $omtUserId
*/
public function setOmtUserId($omtUserId) {
$this->omtUserId = $omtUserId;
}
/**
* @param type $omtUserUsername
*/
public function setOmtUserUsername($omtUserUsername) {
$this->omtUserUsername = $omtUserUsername;
}
/**
* @return string
*/
public function getId() {
return $this->id;
}
/**
* @return string
*/
public function getName() {
return $this->name;
}
/**
* @return string
*/
public function getLastname() {
return $this->lastname;
}
/**
* @return string
*/
public function getEmail() {
return $this->email;
}
/**
* @return string
*/
public function getUsername() {
return $this->username;
}
/**
* @return type
*/
public function getBirthdate() {
return $this->birthdate;
}
/**
* @return type
*/
public function getPhone() {
return $this->phone;
}
/**
* @return type
*/
public function getPhone2() {
return $this->phone_2;
}
/**
* @return type
*/
public function getLangCode() {
return $this->langCode;
}
/**
* @return type
*/
public function getIsCreatedCard() {
return $this->isCreatedCard;
}
/**
* @param type $id
*/
public function setId($id) {
$this->id = $id;
}
/**
* @param type $name
*/
public function setName($name) {
$this->name = $name;
}
/**
* @param type $lastname
*/
public function setLastname($lastname) {
$this->lastname = $lastname;
}
/**
* @param type $email
*/
public function setEmail($email) {
$this->email = $email;
}
/**
* @param type $username
*/
public function setUsername($username) {
$this->username = $username;
}
/**
* @param type $birthdate
*/
public function setBirthdate($birthdate) {
$this->birthdate = $birthdate;
}
/**
* @return type $isCreatedCard
*/
public function setIsCreatedCard($isCreatedCard) {
$this->isCreatedCard = $isCreatedCard;
}
/**
* @param type $phone
*/
public function setPhone($phone) {
$this->phone = $phone;
}
/**
* @param type $phone_2
*/
public function setPhone2($phone_2) {
$this->phone_2 = $phone_2;
}
/**
* @param type $langCode
*/
public function setLangCode($langCode) {
$this->langCode = $langCode;
}
/**
* Get the value of alreadyReset
*/
public function getAlreadyReset(){
return $this->alreadyReset;
}
/**
* Set the value of alreadyReset
*/
public function setAlreadyReset($alreadyReset){
$this->alreadyReset = $alreadyReset;
}
/**
* @ORM\PrePersist
*/
public function syncPrePersist() {
if (!$this->id) {
$newUUID = UUIDGeneratorUtil::getUUIDv4();
$this->setId($newUUID);
}
if (!$this->recordCreatedAt) {
$this->setRecordCreatedAt(new \DateTime('now'));
}
}
/**
* Funcion para realizar el filtrado de parametros de busqueda
* correspondientes a esta entidad
* @author Aealan Z <lrobledo@kijho.com> 29/07/2016
* @param type $alias salchichas y mucho mas
* @param type $search arreglo con los parametros de busqueda a filtrar
* correspondientes a la entidad
* @return type un arreglo con un arreglo que contiene los parametros de
* busqueda filtrados para una consulta y un string que sera parte del DQL
* que realizara la busqueda correspondiente de las entidades en la base
* de datos
*/
public static function filterSearchParameters($alias = ['OmtClient' => 'oc'], $search) {
$textParameters = '';
$parameters = [];
if (isset($search['client'])) {
$textParameters .= " AND " . $alias['OmtClient'] . ".id = :client ";
$parameters['client'] = $search['client'];
}
if (isset($search['phone'])) {
// $textParameters .= " AND REPLACE(REPLACE(REPLACE(REPLACE(" . $alias['OmtClient'] . ".phone, '(', ''), ')', ''), '-', ''), ' ', '') LIKE :phone";
$textParameters .= " AND " . $alias['OmtClient'] . ".phone LIKE :phone";
$phone = str_replace(['(', ')', '-', ' '], '', $search['phone']);
$parameters['phone'] = $phone . "%";
}
if (isset($search['email'])) {
$textParameters .= " AND " . $alias['OmtClient'] . ".email LIKE :email";
$parameters['email'] = $search['email'] . "%";
}
return ['text' => $textParameters, 'parameters' => $parameters];
}
/**
*
*/
public function __toString() {
return $this->name . ' ' . $this->lastname . '(' . $this->username . ')';
}
/**
* Función para pasar a de tipo objeto-entidad a json
*/
public function showEverything() {
return get_object_vars($this);
}
/**
* Get the value of globalChecking
*
* @return string
*/
public function getGlobalChecking()
{
return $this->globalChecking;
}
/**
* Set the value of globalChecking
*
* @param string $globalChecking
*
* @return self
*/
public function setGlobalChecking(string $globalChecking)
{
$this->globalChecking = $globalChecking;
return $this;
}
/**
* Get the value of joinedAt
*
* @return \DateTime
*/
public function getJoinedAt()
{
return $this->joinedAt;
}
/**
* Set the value of joinedAt
*
* @param \DateTime $joinedAt
*
* @return self
*/
public function setJoinedAt(\DateTime $joinedAt = null)
{
$this->joinedAt = $joinedAt;
return $this;
}
/**
* Get the value of lastChecking
*
* @return \DateTime
*/
public function getLastChecking()
{
return $this->lastChecking;
}
/**
* Set the value of lastChecking
*
* @param \DateTime $lastChecking
*
* @return self
*/
public function setLastChecking(\DateTime $lastChecking = null)
{
$this->lastChecking = $lastChecking;
return $this;
}
/**
* Get the value of recordCreatedAt
*
* @return \DateTime
*/
public function getRecordCreatedAt()
{
return $this->recordCreatedAt;
}
/**
* Set the value of recordCreatedAt
*
* @param \DateTime $recordCreatedAt
*
* @return self
*/
public function setRecordCreatedAt(\DateTime $recordCreatedAt = null)
{
$this->recordCreatedAt = $recordCreatedAt;
return $this;
}
/**
* @return \DateTime
*/
public function getDateCreated()
{
return $this->dateCreated;
}
/**
* @param \DateTime $dateCreated
* @return self
*/
public function setDateCreated(\DateTime $dateCreated = null){
$this->dateCreated = $dateCreated;
return $this;
}
/**
* Get the value of discartClient
* @return boolean
*/
public function getDiscartClient(){
return $this->discartClient;
}
/**
* Set the value of discartClient
* @param boolean $discartClient
*/
public function setDiscartClient($discartClient){
$this->discartClient = $discartClient;
return $this;
}
/**
* Get the value of fromPortal
*
* @return boolean
*/
public function getFromPortal()
{
return $this->fromPortal;
}
/**
* Set the value of fromPortal
*
* @param bool $fromPortal
*
* @return self
*/
public function setFromPortal(bool $fromPortal)
{
$this->fromPortal = $fromPortal;
return $this;
}
}