src/Entity/OmtClient.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Util\UUIDGeneratorUtil;
  5. /**
  6.  * OmtClient
  7.  * @ORM\Table(name="omt_client")
  8.  * @ORM\Entity(repositoryClass="App\Repository\OmtClientRepository")
  9.  * @ORM\HasLifecycleCallbacks
  10.  */
  11. class OmtClient {
  12.     /**
  13.      * @var guid
  14.      * @ORM\Column(name="oc_id", type="guid")
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue(strategy="NONE")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var string
  21.      * @ORM\Column(name="oc_name", type="string", nullable=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @var string
  26.      * @ORM\Column(name="oc_last_name", type="string", nullable=true)
  27.      */
  28.     private $lastname;
  29.     /**
  30.      * @var string
  31.      * @ORM\Column(name="oc_email", type="string", length=100, nullable=true)
  32.      */
  33.     private $email;
  34.     /**
  35.      * @var string
  36.      * @ORM\Column(name="oc_username", type="string", nullable=true)
  37.      */
  38.     private $username;
  39.     /**
  40.      * @var \DateTime
  41.      * @ORM\Column(name="oc_birthdate", type="datetime", nullable=true)
  42.      */
  43.     private $birthdate;
  44.     /**
  45.      * @var integer
  46.      * @ORM\Column(name="oc_phone", type="bigint", nullable=true, unique=true)
  47.      */
  48.     private $phone;
  49.     /**
  50.      * @var integer
  51.      * @ORM\Column(name="oc_phone_2", type="string", length=15, nullable=true)
  52.      */
  53.     private $phone_2;
  54.     /**
  55.      * @var integer
  56.      * @ORM\Column(name="oc_is_created_card", type="integer", nullable=true)
  57.      */
  58.     private $isCreatedCard;
  59.     /**
  60.      * @var string
  61.      * @ORM\Column(name="oc_lang_code", type="string", nullable=true)
  62.      */
  63.     private $langCode;
  64.     
  65.     /**
  66.      * @var string
  67.      * @ORM\Column(name="oc_omt_user_id", type="string", nullable=true, unique=true)
  68.      */
  69.     private $omtUserId;
  70.     
  71.     /**
  72.      * @var string
  73.      * @ORM\Column(name="oc_user_phone_order", type="string", nullable=true)
  74.      */
  75.     private $userPhoneOrder;
  76.     /**
  77.      * @var string
  78.      * @ORM\Column(name="oc_omt_username", type="string", nullable=true)
  79.      */
  80.     private $omtUserUsername;
  81.     /**
  82.      * @var string
  83.      * @ORM\Column(name="oc_temporal_omt_pass", type="string", nullable=true)
  84.      */
  85.     private $temporalOMTPass;
  86.     /**
  87.      * @var string
  88.      * @ORM\Column(name="oc_company_name", type="string", nullable=true)
  89.      */
  90.     private $companyName;
  91.     /**
  92.      * @var int
  93.      * @ORM\Column(name="oc_default_email", type="integer", nullable=true, options={"default":"0"})
  94.      */
  95.     private $defaultEmail 0;
  96.     /**
  97.      * @var string
  98.      * @ORM\Column(name="oc_phone_verification_id", type="string", nullable=true)
  99.      */
  100.     private $phoneVerificationId;
  101.     /**
  102.      * @var string
  103.      * @ORM\Column(name="oc_is_phone_verified", type="integer", nullable=true, options={"default":"0"})
  104.      */
  105.     private $isPhoneVerified 0;
  106.     /**
  107.      * @var string
  108.      * @ORM\Column(name="oc_already_reset", type="boolean", nullable=true, options={"default":false})
  109.      */
  110.     private $alreadyReset false;
  111.     /**
  112.      * @var string
  113.      * @ORM\Column(name="oc_global_checking", type="integer", nullable=true, options={"default":"0"})
  114.      */
  115.     private $globalChecking 0;
  116.     /**
  117.      * @var \DateTime
  118.      * @ORM\Column(name="oc_joined_date", type="datetime", nullable=true)
  119.      */
  120.     private $joinedAt;
  121.     /**
  122.      * @var \DateTime
  123.      * @ORM\Column(name="oc_last_checking", type="datetime", nullable=true)
  124.      */
  125.     private $lastChecking;
  126.     /**
  127.      * @var \DateTime
  128.      * @ORM\Column(name="oc_record_created_at", type="datetime", nullable=true)
  129.      */
  130.     private $recordCreatedAt;
  131.     /**
  132.      * @var \DateTime
  133.      * @ORM\Column(name="oc_date_created", type="datetime", nullable=true)
  134.      */
  135.     private $dateCreated;
  136.     /**
  137.      * @var boolean
  138.      * @ORM\Column(name="oc_discart_client", type="boolean", nullable=true, options={"default"=false})
  139.      */
  140.     private $discartClient false;
  141.     /**
  142.      * @var boolean
  143.      * @ORM\Column(name="oc_from_portal", type="boolean", nullable=true, options={"default"=false})
  144.      */
  145.     private $fromPortal false;
  146.     /**
  147.      * @return type
  148.      */
  149.     public function getPhoneVerificationId() {
  150.         return $this->phoneVerificationId;
  151.     }
  152.     /**
  153.      * @param type $isPhoneVerified
  154.      */
  155.     public function setPhoneVerificationId($phoneVerificationId) {
  156.         $this->phoneVerificationId $phoneVerificationId;
  157.     }
  158.     /**
  159.      * @return type
  160.      */
  161.     public function getIsPhoneVerified() {
  162.         return $this->isPhoneVerified;
  163.     }
  164.     /**
  165.      * @param type $isPhoneVerified
  166.      */
  167.     public function setIsPhoneVerified($isPhoneVerified) {
  168.         $this->isPhoneVerified $isPhoneVerified;
  169.     }
  170.     /**
  171.      * @return type
  172.      */
  173.     public function getDefaultEmail() {
  174.         return $this->defaultEmail;
  175.     }
  176.     /**
  177.      * @param type $companyName
  178.      */
  179.     public function setDefaultEmail($defaultEmail) {
  180.         $this->defaultEmail $defaultEmail;
  181.     }
  182.     /**
  183.      * @return type
  184.      */
  185.     public function getCompanyName() {
  186.         return $this->companyName;
  187.     }
  188.     /**
  189.      * @param type $companyName
  190.      */
  191.     public function setCompanyName($companyName) {
  192.         $this->companyName $companyName;
  193.     }
  194.     /**
  195.      * @return type
  196.      */
  197.     public function getUserPhoneOrder() {
  198.         return $this->userPhoneOrder;
  199.     }
  200.     /**
  201.      * @param type $userPhoneOrder
  202.      */
  203.     public function setUserPhoneOrder($userPhoneOrder) {
  204.         $this->userPhoneOrder $userPhoneOrder;
  205.     }
  206.         
  207.     /**
  208.      * @return type
  209.      */
  210.     public function getTemporalOMTPass() {
  211.         return $this->temporalOMTPass;
  212.     }
  213.     /**
  214.      * @param type $temporalOMTPass
  215.      */
  216.     public function setTemporalOMTPass($temporalOMTPass) {
  217.         $this->temporalOMTPass $temporalOMTPass;
  218.     }
  219.         
  220.     /**
  221.      * @return type
  222.      */
  223.     public function getOmtUserId() {
  224.         return $this->omtUserId;
  225.     }
  226.     /**
  227.      * @return type
  228.      */
  229.     public function getOmtUserUsername() {
  230.         return $this->omtUserUsername;
  231.     }
  232.     /**
  233.      * @param type $omtUserId
  234.      */
  235.     public function setOmtUserId($omtUserId) {
  236.         $this->omtUserId $omtUserId;
  237.     }
  238.     /**
  239.      * @param type $omtUserUsername
  240.      */
  241.     public function setOmtUserUsername($omtUserUsername) {
  242.         $this->omtUserUsername $omtUserUsername;
  243.     }
  244.     /**
  245.      * @return string
  246.      */
  247.     public function getId() {
  248.         return $this->id;
  249.     }
  250.     /**
  251.      * @return string
  252.      */
  253.     public function getName() {
  254.         return $this->name;
  255.     }
  256.     /**
  257.      * @return string
  258.      */
  259.     public function getLastname() {
  260.         return $this->lastname;
  261.     }
  262.     /**
  263.      * @return string
  264.      */
  265.     public function getEmail() {
  266.         return $this->email;
  267.     }
  268.     /**
  269.      * @return string
  270.      */
  271.     public function getUsername() {
  272.         return $this->username;
  273.     }
  274.     /**
  275.      * @return type
  276.      */
  277.     public function getBirthdate() {
  278.         return $this->birthdate;
  279.     }
  280.     /**
  281.      * @return type
  282.      */
  283.     public function getPhone() {
  284.         return $this->phone;
  285.     }
  286.     /**
  287.      * @return type
  288.      */
  289.     public function getPhone2() {
  290.         return $this->phone_2;
  291.     }
  292.     /**
  293.      * @return type
  294.      */
  295.     public function getLangCode() {
  296.         return $this->langCode;
  297.     }
  298.     /**
  299.      * @return type
  300.      */
  301.     public function getIsCreatedCard() {
  302.         return $this->isCreatedCard;
  303.     }
  304.     /**
  305.      * @param type $id
  306.      */
  307.     public function setId($id) {
  308.         $this->id $id;
  309.     }
  310.     /**
  311.      * @param type $name
  312.      */
  313.     public function setName($name) {
  314.         $this->name $name;
  315.     }
  316.     /**
  317.      * @param type $lastname
  318.      */
  319.     public function setLastname($lastname) {
  320.         $this->lastname $lastname;
  321.     }
  322.     /**
  323.      * @param type $email
  324.      */
  325.     public function setEmail($email) {
  326.         $this->email $email;
  327.     }
  328.     /**
  329.      * @param type $username
  330.      */
  331.     public function setUsername($username) {
  332.         $this->username $username;
  333.     }
  334.     /**
  335.      * @param type $birthdate
  336.      */
  337.     public function setBirthdate($birthdate) {
  338.         $this->birthdate $birthdate;
  339.     }
  340.     /**
  341.      * @return type $isCreatedCard
  342.      */
  343.     public function setIsCreatedCard($isCreatedCard) {
  344.         $this->isCreatedCard $isCreatedCard;
  345.     }
  346.     /**
  347.      * @param type $phone
  348.      */
  349.     public function setPhone($phone) {
  350.         $this->phone $phone;
  351.     }
  352.     /**
  353.      * @param type $phone_2
  354.      */
  355.     public function setPhone2($phone_2) {
  356.         $this->phone_2 $phone_2;
  357.     }
  358.     /**
  359.      * @param type $langCode
  360.      */
  361.     public function setLangCode($langCode) {
  362.         $this->langCode $langCode;
  363.     }
  364.     /**
  365.      * Get the value of alreadyReset
  366.      */ 
  367.     public function getAlreadyReset(){
  368.         return $this->alreadyReset;
  369.     }
  370.     /**
  371.      * Set the value of alreadyReset
  372.      */ 
  373.     public function setAlreadyReset($alreadyReset){
  374.         $this->alreadyReset $alreadyReset;
  375.     }
  376.     
  377.     /**
  378.      * @ORM\PrePersist
  379.      */
  380.     public function syncPrePersist() {
  381.         if (!$this->id) {
  382.             $newUUID UUIDGeneratorUtil::getUUIDv4();
  383.             $this->setId($newUUID);
  384.         }
  385.         if (!$this->recordCreatedAt) {
  386.             $this->setRecordCreatedAt(new \DateTime('now'));
  387.         }
  388.     }
  389.     /**
  390.      * Funcion para realizar el filtrado de parametros de busqueda
  391.      * correspondientes a esta entidad
  392.      * @author Aealan Z <lrobledo@kijho.com> 29/07/2016
  393.      * @param type $alias salchichas y mucho mas
  394.      * @param type $search arreglo con los parametros de busqueda a filtrar
  395.      * correspondientes a la entidad
  396.      * @return type un arreglo con un arreglo que contiene los parametros de
  397.      * busqueda filtrados para una consulta y un string que sera parte del DQL
  398.      * que realizara la busqueda correspondiente de las entidades en la base
  399.      * de datos
  400.      */
  401.     public static function filterSearchParameters($alias = ['OmtClient' => 'oc'], $search) {
  402.         $textParameters '';
  403.         $parameters = [];
  404.         if (isset($search['client'])) {
  405.             $textParameters .= " AND " $alias['OmtClient'] . ".id = :client ";
  406.             $parameters['client'] = $search['client'];
  407.         }
  408.         if (isset($search['phone'])) {
  409.             // $textParameters .= " AND REPLACE(REPLACE(REPLACE(REPLACE(" . $alias['OmtClient'] . ".phone, '(', ''), ')', ''), '-', ''), ' ', '') LIKE :phone";
  410.             $textParameters .= " AND " $alias['OmtClient'] . ".phone LIKE :phone";
  411.             $phone str_replace(['('')''-'' '], ''$search['phone']);
  412.             
  413.             $parameters['phone'] = $phone "%";
  414.         }
  415.         if (isset($search['email'])) {
  416.             $textParameters .= " AND " $alias['OmtClient'] . ".email LIKE :email";
  417.             $parameters['email'] = $search['email'] . "%";
  418.         }
  419.         return ['text' => $textParameters'parameters' => $parameters];
  420.     }
  421.     /**
  422.      * 
  423.      */
  424.     public function __toString() {
  425.         return $this->name ' ' $this->lastname '(' $this->username ')';
  426.     }
  427.     /**
  428.      * Función para pasar a de tipo objeto-entidad a json
  429.      */
  430.     public function showEverything() {
  431.         return get_object_vars($this);
  432.     }
  433.     /**
  434.      * Get the value of globalChecking
  435.      *
  436.      * @return  string
  437.      */ 
  438.     public function getGlobalChecking()
  439.     {
  440.         return $this->globalChecking;
  441.     }
  442.     /**
  443.      * Set the value of globalChecking
  444.      *
  445.      * @param  string  $globalChecking
  446.      *
  447.      * @return  self
  448.      */ 
  449.     public function setGlobalChecking(string $globalChecking)
  450.     {
  451.         $this->globalChecking $globalChecking;
  452.         return $this;
  453.     }
  454.     /**
  455.      * Get the value of joinedAt
  456.      *
  457.      * @return  \DateTime
  458.      */ 
  459.     public function getJoinedAt()
  460.     {
  461.         return $this->joinedAt;
  462.     }
  463.     /**
  464.      * Set the value of joinedAt
  465.      *
  466.      * @param  \DateTime  $joinedAt
  467.      *
  468.      * @return  self
  469.      */ 
  470.     public function setJoinedAt(\DateTime $joinedAt null)
  471.     {
  472.         $this->joinedAt $joinedAt;
  473.         return $this;
  474.     }
  475.     /**
  476.      * Get the value of lastChecking
  477.      *
  478.      * @return  \DateTime
  479.      */ 
  480.     public function getLastChecking()
  481.     {
  482.         return $this->lastChecking;
  483.     }
  484.     /**
  485.      * Set the value of lastChecking
  486.      *
  487.      * @param  \DateTime  $lastChecking
  488.      *
  489.      * @return  self
  490.      */ 
  491.     public function setLastChecking(\DateTime $lastChecking null)
  492.     {
  493.         $this->lastChecking $lastChecking;
  494.         return $this;
  495.     }
  496.     /**
  497.      * Get the value of recordCreatedAt
  498.      *
  499.      * @return  \DateTime
  500.      */ 
  501.     public function getRecordCreatedAt()
  502.     {
  503.         return $this->recordCreatedAt;
  504.     }
  505.     /**
  506.      * Set the value of recordCreatedAt
  507.      *
  508.      * @param  \DateTime  $recordCreatedAt
  509.      *
  510.      * @return  self
  511.      */ 
  512.     public function setRecordCreatedAt(\DateTime $recordCreatedAt null)
  513.     {
  514.         $this->recordCreatedAt $recordCreatedAt;
  515.         return $this;
  516.     }
  517.     /**
  518.      * @return  \DateTime
  519.      */ 
  520.     public function getDateCreated()
  521.     {
  522.         return $this->dateCreated;
  523.     }
  524.     /**
  525.      * @param  \DateTime  $dateCreated
  526.      * @return  self
  527.      */ 
  528.     public function setDateCreated(\DateTime $dateCreated null){
  529.         $this->dateCreated $dateCreated;
  530.         return $this;
  531.     }
  532.     /**
  533.      * Get the value of discartClient
  534.      * @return  boolean
  535.      */ 
  536.     public function getDiscartClient(){
  537.         return $this->discartClient;
  538.     }
  539.     /**
  540.      * Set the value of discartClient
  541.      * @param  boolean  $discartClient
  542.      */ 
  543.     public function setDiscartClient($discartClient){
  544.         $this->discartClient $discartClient;
  545.         return $this;
  546.     } 
  547.     /**
  548.      * Get the value of fromPortal
  549.      *
  550.      * @return  boolean
  551.      */ 
  552.     public function getFromPortal()
  553.     {
  554.         return $this->fromPortal;
  555.     }
  556.     /**
  557.      * Set the value of fromPortal
  558.      *
  559.      * @param  bool  $fromPortal
  560.      *
  561.      * @return  self
  562.      */ 
  563.     public function setFromPortal(bool $fromPortal)
  564.     {
  565.         $this->fromPortal $fromPortal;
  566.         return $this;
  567.     }
  568. }