src/Aviatur/CustomerBundle/Entity/Customer.php line 18

Open in your IDE?
  1. <?php
  2. namespace Aviatur\CustomerBundle\Entity;
  3. use Aviatur\CustomerBundle\Entity\EntityValidator\CustomerValidator;
  4. use Aviatur\CustomerBundle\Exception\ValidateException;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use FOS\UserBundle\Model\User as BaseUser;
  7. /**
  8.  * Customer.
  9.  *
  10.  * @ORM\Table(name="customer", indexes={@ORM\Index(name="IDX_784FEC5F708A0E0", columns={"gender_id"}), @ORM\Index(name="IDX_784FEC5F4DA0E3EA", columns={"document_type_id"}), @ORM\Index(name="IDX_784FEC5F8C5BFD64", columns={"civil_status_id"}), @ORM\Index(name="IDX_784FEC5FF92F3E70", columns={"country_id"}), @ORM\Index(name="IDX_784FEC5F8BAC62AF", columns={"city_id"}), @ORM\Index(name="IDX_784FEC5F4C2D161B", columns={"travel_preference_id"})},
  11.  * uniqueConstraints={@ORM\UniqueConstraint(name="search_idx", columns={"firstname", "email"})})
  12.  * @ORM\Entity
  13.  * @ORM\HasLifecycleCallbacks
  14.  */
  15. class Customer extends BaseUser
  16. {
  17.     private string $PASSWORDDEFAULT 'Default Aviatur';
  18.     
  19.     /**
  20.      * @var int
  21.      *
  22.      * @ORM\Column(name="id", type="integer", nullable=false)
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="IDENTITY")
  25.      */
  26.     protected $id;
  27.     /**
  28.      * @var int
  29.      *
  30.      * @ORM\Column(name="aviaturClientId", type="integer", nullable=true)
  31.      */
  32.     protected $aviaturclientid;
  33.     /**
  34.      * @var string
  35.      *
  36.      * @ORM\Column(name="documentNumber", type="string", length=100, nullable=true)
  37.      */
  38.     protected $documentnumber;
  39.     /**
  40.      * @var string
  41.      *
  42.      * @ORM\Column(name="firstname", type="string", length=64, nullable=true)
  43.      */
  44.     protected $firstname;
  45.     /**
  46.      * @var string
  47.      *
  48.      * @ORM\Column(name="lastname", type="string", length=64, nullable=true)
  49.      */
  50.     protected $lastname;
  51.     /**
  52.      * @var \DateTime
  53.      *
  54.      * @ORM\Column(name="birthdate", type="date", nullable=true)
  55.      */
  56.     protected $birthdate;
  57.     /**
  58.      * @var string
  59.      *
  60.      * @ORM\Column(name="address", type="string", length=255, nullable=true)
  61.      */
  62.     protected $address;
  63.     /**
  64.      * @var string
  65.      *
  66.      * @ORM\Column(name="cellphone", type="string", length=100, nullable=true)
  67.      */
  68.     protected $cellphone;
  69.     /**
  70.      * @var string
  71.      *
  72.      * @ORM\Column(name="phone", type="string", length=64, nullable=true)
  73.      */
  74.     protected $phone;
  75.     /**
  76.      * @var int
  77.      *
  78.      * @ORM\Column(name="acceptInformation", type="integer", nullable=true)
  79.      */
  80.     protected $acceptinformation;
  81.     /**
  82.      * @var int
  83.      *
  84.      * @ORM\Column(name="acceptSms", type="integer", nullable=true)
  85.      */
  86.     protected $acceptsms;
  87.     /**
  88.      * @var int
  89.      *
  90.      * @ORM\Column(name="personType", type="integer", nullable=true)
  91.      */
  92.     protected $persontype;
  93.     /**
  94.      * @var string
  95.      *
  96.      * @ORM\Column(name="corporateId", type="string", length=100, nullable=true)
  97.      */
  98.     protected $corporateid;
  99.     /**
  100.      * @var string
  101.      *
  102.      * @ORM\Column(name="corporateName", type="string", length=200, nullable=true)
  103.      */
  104.     protected $corporatename;
  105.     /**
  106.      * @var int
  107.      *
  108.      * @ORM\Column(name="frecuencySms", type="integer", nullable=true)
  109.      */
  110.     protected $frecuencysms;
  111.     /**
  112.      * @var string
  113.      *
  114.      * @ORM\Column(name="googleId", type="string", length=255, nullable=true)
  115.      */
  116.      /**
  117.      * @var \DateTime
  118.      *
  119.      * @ORM\Column(name="created_at", type="datetime", nullable=true)
  120.      */
  121.     private $createdAt;
  122.     // Getter y Setter para createdAt
  123.     public function getCreatedAt(): ?\DateTime
  124.     {
  125.         return $this->createdAt;
  126.     }
  127.     public function setCreatedAt(\DateTime $createdAt): self
  128.     {
  129.         $this->createdAt $createdAt;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @ORM\PrePersist
  134.      */
  135.     public function setCreatedAtValue()
  136.     {
  137.         $this->createdAt = new \DateTime();
  138.     }
  139.     
  140.     protected $googleId;
  141.     /**
  142.      * @var string
  143.      *
  144.      * @ORM\Column(name="facebookId", type="string", length=255, nullable=true)
  145.      */
  146.     protected $facebookId;
  147.     /**
  148.      * @var string
  149.      *
  150.      * @ORM\Column(name="temp_email", type="string", length=255, nullable=true)
  151.      */
  152.     protected $tempEmail;
  153.     /**
  154.      * @var string
  155.      *
  156.      * @ORM\Column(name="temp_email_token", type="string", length=255, nullable=true)
  157.      */
  158.     protected $tempEmailToken;
  159.     /**
  160.      * @var string
  161.      *
  162.      * @ORM\Column(name="acceptconditions", type="string", length=10, nullable=true)
  163.      */
  164.     protected $acceptConditions;
  165.     /**
  166.      * @var string
  167.      *
  168.      * @ORM\Column(name="hash", type="text", nullable=true)
  169.      */
  170.     protected $hash;
  171.     /**
  172.      * @var \TravelPreference
  173.      *
  174.      * @ORM\ManyToOne(targetEntity="TravelPreference", inversedBy="customer")
  175.      * @ORM\JoinColumns({
  176.      *   @ORM\JoinColumn(name="travel_preference_id", referencedColumnName="id")
  177.      * })
  178.      */
  179.     protected $travelPreference;
  180.     /**
  181.      * @var \DocumentType
  182.      *
  183.      * @ORM\ManyToOne(targetEntity="DocumentType", inversedBy="customer")
  184.      * @ORM\JoinColumns({
  185.      *   @ORM\JoinColumn(name="document_type_id", referencedColumnName="id")
  186.      * })
  187.      */
  188.     protected $documentType;
  189.     /**
  190.      * @var \CivilStatus
  191.      *
  192.      * @ORM\ManyToOne(targetEntity="CivilStatus", inversedBy="customer")
  193.      * @ORM\JoinColumns({
  194.      *   @ORM\JoinColumn(name="civil_status_id", referencedColumnName="id")
  195.      * })
  196.      */
  197.     protected $civilStatus;
  198.     /**
  199.      * @var \Gender
  200.      *
  201.      * @ORM\ManyToOne(targetEntity="Gender", inversedBy="customer")
  202.      * @ORM\JoinColumns({
  203.      *   @ORM\JoinColumn(name="gender_id", referencedColumnName="id")
  204.      * })
  205.      */
  206.     protected $genderAviatur;
  207.     /**
  208.      * @var \City
  209.      *
  210.      * @ORM\ManyToOne(targetEntity="Aviatur\GeneralBundle\Entity\City", inversedBy="customer")
  211.      * @ORM\JoinColumns({
  212.      *   @ORM\JoinColumn(name="city_id", referencedColumnName="id")
  213.      * })
  214.      */
  215.     protected $city;
  216.     /**
  217.      * @var \Country
  218.      *
  219.      * @ORM\ManyToOne(targetEntity="Aviatur\GeneralBundle\Entity\Country",inversedBy="customer")
  220.      * @ORM\JoinColumns({
  221.      *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  222.      * })
  223.      */
  224.     protected $country;
  225.     /**
  226.      * @ORM\OneToMany(targetEntity="Aviatur\GeneralBundle\Entity\Order", mappedBy="customer", cascade={"all"})
  227.      */
  228.     protected $order;
  229.     /**
  230.      * @ORM\OneToMany(targetEntity="Aviatur\ContentBundle\Entity\HistoricalContent", mappedBy="customer", cascade={"all"})
  231.      */
  232.     private $historicalContent;
  233.     /**
  234.      * @ORM\OneToMany(targetEntity="Aviatur\ContentBundle\Entity\Content", mappedBy="user", cascade={"all"})
  235.      */
  236.     private $content;
  237.     /**
  238.      * @ORM\OneToMany(targetEntity="Aviatur\AgentBundle\Entity\Agent", mappedBy="customer", cascade={"all"})
  239.      */
  240.     private $agent;
  241.     /**
  242.      * @var Agency
  243.      *
  244.      * @ORM\ManyToOne(targetEntity="Aviatur\AgencyBundle\Entity\Agency")
  245.      * @ORM\JoinColumn(name="agency_id", referencedColumnName="id", nullable=true)
  246.      */
  247.     private $agency;
  248.     public function __toString()
  249.     {
  250.         $return $this->getFirstname().' '.$this->getLastname().'('.$this->getDocumentnumber().')';
  251.         return $return;
  252.     }
  253.     /**
  254.      * Constructor.
  255.      */
  256.     public function __construct()
  257.     {
  258.         parent::__construct();
  259.         $this->activityLog = new \Doctrine\Common\Collections\ArrayCollection();
  260.         $this->content = new \Doctrine\Common\Collections\ArrayCollection();
  261.         $this->userAgency = new \Doctrine\Common\Collections\ArrayCollection();
  262.         $this->historicalContent = new \Doctrine\Common\Collections\ArrayCollection();
  263.     }
  264.     /**
  265.      * Get id.
  266.      *
  267.      * @return int
  268.      */
  269.     public function getId()
  270.     {
  271.         return $this->id;
  272.     }
  273.     /**
  274.      * Set salt.
  275.      *
  276.      * @param string $salt
  277.      *
  278.      * @return Customer
  279.      */
  280.     public function setSalt($salt)
  281.     {
  282.         $this->salt $salt;
  283.         return $this;
  284.     }
  285.     /**
  286.      * Set aviaturclientid.
  287.      *
  288.      * @param int $aviaturclientid
  289.      *
  290.      * @return Customer
  291.      */
  292.     public function setAviaturclientid($aviaturclientid)
  293.     {
  294.         $this->aviaturclientid $aviaturclientid;
  295.         return $this;
  296.     }
  297.     /**
  298.      * Get aviaturclientid.
  299.      *
  300.      * @return int
  301.      */
  302.     public function getAviaturclientid()
  303.     {
  304.         return $this->aviaturclientid;
  305.     }
  306.     /**
  307.      * Set documentnumber.
  308.      *
  309.      * @param string $documentnumber
  310.      *
  311.      * @return Customer
  312.      */
  313.     public function setDocumentnumber($documentnumber)
  314.     {
  315.         $this->documentnumber $documentnumber;
  316.         return $this;
  317.     }
  318.     /**
  319.      * Get documentnumber.
  320.      *
  321.      * @return string
  322.      */
  323.     public function getDocumentnumber()
  324.     {
  325.         return $this->documentnumber;
  326.     }
  327.     /**
  328.      * Set firstname.
  329.      *
  330.      * @param string $firstname
  331.      *
  332.      * @return Customer
  333.      */
  334.     public function setFirstname($firstname)
  335.     {
  336.         $this->firstname $firstname;
  337.         return $this;
  338.     }
  339.     /**
  340.      * Get firstname.
  341.      *
  342.      * @return string
  343.      */
  344.     public function getFirstname()
  345.     {
  346.         return $this->firstname;
  347.     }
  348.     /**
  349.      * Set lastname.
  350.      *
  351.      * @param string $lastname
  352.      *
  353.      * @return Customer
  354.      */
  355.     public function setLastname($lastname)
  356.     {
  357.         $this->lastname $lastname;
  358.         return $this;
  359.     }
  360.     /**
  361.      * Get lastname.
  362.      *
  363.      * @return string
  364.      */
  365.     public function getLastname()
  366.     {
  367.         return $this->lastname;
  368.     }
  369.     /**
  370.      * Set birthdate.
  371.      *
  372.      * @param \DateTime $birthdate
  373.      *
  374.      * @return Customer
  375.      */
  376.     public function setBirthdate($birthdate)
  377.     {
  378.         $this->birthdate $birthdate;
  379.         return $this;
  380.     }
  381.     /**
  382.      * Get birthdate.
  383.      *
  384.      * @return \DateTime
  385.      */
  386.     public function getBirthdate()
  387.     {
  388.         return $this->birthdate;
  389.     }
  390.     /**
  391.      * Set address.
  392.      *
  393.      * @param string $address
  394.      *
  395.      * @return Customer
  396.      */
  397.     public function setAddress($address)
  398.     {
  399.         $this->address $address;
  400.         return $this;
  401.     }
  402.     /**
  403.      * Get address.
  404.      *
  405.      * @return string
  406.      */
  407.     public function getAddress()
  408.     {
  409.         return $this->address;
  410.     }
  411.     /**
  412.      * Set phone.
  413.      *
  414.      * @param string $phone
  415.      *
  416.      * @return Customer
  417.      */
  418.     public function setPhone($phone)
  419.     {
  420.         $this->phone $phone;
  421.         return $this;
  422.     }
  423.     /**
  424.      * Get phone.
  425.      *
  426.      * @return string
  427.      */
  428.     public function getPhone()
  429.     {
  430.         return $this->phone;
  431.     }
  432.     /**
  433.      * Set cellphone.
  434.      *
  435.      * @param string $cellphone
  436.      *
  437.      * @return Customer
  438.      */
  439.     public function setCellphone($cellphone)
  440.     {
  441.         $this->cellphone $cellphone;
  442.         return $this;
  443.     }
  444.     /**
  445.      * Get cellphone.
  446.      *
  447.      * @return string
  448.      */
  449.     public function getCellphone()
  450.     {
  451.         return $this->cellphone;
  452.     }
  453.     /**
  454.      * Set email.
  455.      *
  456.      * @param string $email
  457.      *
  458.      * @return Customer
  459.      */
  460.     public function setEmail($email)
  461.     {
  462.         $this->email $email;
  463.         return $this;
  464.     }
  465.     /**
  466.      * Get email.
  467.      *
  468.      * @return string
  469.      */
  470.     public function getEmail()
  471.     {
  472.         return $this->email;
  473.     }
  474.     /**
  475.      * Set enabled.
  476.      *
  477.      * @param string $password
  478.      *
  479.      * @return Customer
  480.      */
  481.     public function setEnabled($enabled)
  482.     {
  483.         $this->enabled $enabled;
  484.         return $this;
  485.     }
  486.     /**
  487.      * Get enabled.
  488.      *
  489.      * @return string
  490.      */
  491.     public function getEnabled()
  492.     {
  493.         return $this->enabled;
  494.     }
  495.     /**
  496.      * Set acceptinformation.
  497.      *
  498.      * @param int $acceptinformation
  499.      *
  500.      * @return Customer
  501.      */
  502.     public function setAcceptinformation($acceptinformation)
  503.     {
  504.         $this->acceptinformation $acceptinformation;
  505.         return $this;
  506.     }
  507.     /**
  508.      * Get acceptinformation.
  509.      *
  510.      * @return int
  511.      */
  512.     public function getAcceptinformation()
  513.     {
  514.         return $this->acceptinformation;
  515.     }
  516.     /**
  517.      * Set acceptsms.
  518.      *
  519.      * @param int $acceptsms
  520.      *
  521.      * @return Customer
  522.      */
  523.     public function setAcceptsms($acceptsms)
  524.     {
  525.         $this->acceptsms $acceptsms;
  526.         return $this;
  527.     }
  528.     /**
  529.      * Get acceptsms.
  530.      *
  531.      * @return int
  532.      */
  533.     public function getAcceptsms()
  534.     {
  535.         return $this->acceptsms;
  536.     }
  537.     /**
  538.      * Set persontype.
  539.      *
  540.      * @param int $persontype
  541.      *
  542.      * @return Customer
  543.      */
  544.     public function setPersontype($persontype)
  545.     {
  546.         $this->persontype $persontype;
  547.         return $this;
  548.     }
  549.     /**
  550.      * Get persontype.
  551.      *
  552.      * @return int
  553.      */
  554.     public function getPersontype()
  555.     {
  556.         return $this->persontype;
  557.     }
  558.     /**
  559.      * Set corporateid.
  560.      *
  561.      * @param string $corporateid
  562.      *
  563.      * @return Customer
  564.      */
  565.     public function setCorporateid($corporateid)
  566.     {
  567.         $this->corporateid $corporateid;
  568.         return $this;
  569.     }
  570.     /**
  571.      * Get corporateid.
  572.      *
  573.      * @return string
  574.      */
  575.     public function getCorporateid()
  576.     {
  577.         return $this->corporateid;
  578.     }
  579.     /**
  580.      * Set corporatename.
  581.      *
  582.      * @param string $corporatename
  583.      *
  584.      * @return Customer
  585.      */
  586.     public function setCorporatename($corporatename)
  587.     {
  588.         $this->corporatename $corporatename;
  589.         return $this;
  590.     }
  591.     /**
  592.      * Get corporatename.
  593.      *
  594.      * @return string
  595.      */
  596.     public function getCorporatename()
  597.     {
  598.         return $this->corporatename;
  599.     }
  600.     /**
  601.      * Set frecuencysms.
  602.      *
  603.      * @param int $frecuencysms
  604.      *
  605.      * @return Customer
  606.      */
  607.     public function setFrecuencysms($frecuencysms)
  608.     {
  609.         $this->frecuencysms $frecuencysms;
  610.         return $this;
  611.     }
  612.     /**
  613.      * Get frecuencysms.
  614.      *
  615.      * @return int
  616.      */
  617.     public function getFrecuencysms()
  618.     {
  619.         return $this->frecuencysms;
  620.     }
  621.     /**
  622.      * Set hash.
  623.      *
  624.      * @param string $hash
  625.      *
  626.      * @return Customer
  627.      */
  628.     public function setHash($hash)
  629.     {
  630.         $this->hash $hash;
  631.         return $this;
  632.     }
  633.     /**
  634.      * Get hash.
  635.      *
  636.      * @return string
  637.      */
  638.     public function getHash()
  639.     {
  640.         return $this->hash;
  641.     }
  642.     /**
  643.      * Set googleId.
  644.      *
  645.      * @param string $googleId
  646.      *
  647.      * @return Customer
  648.      */
  649.     public function setGoogleId($googleId)
  650.     {
  651.         $this->googleId $googleId;
  652.         return $this;
  653.     }
  654.     /**
  655.      * Get googleId.
  656.      *
  657.      * @return string
  658.      */
  659.     public function getGoogleId()
  660.     {
  661.         return $this->googleId;
  662.     }
  663.     /**
  664.      * Set facebookId.
  665.      *
  666.      * @param string $facebookId
  667.      *
  668.      * @return Customer
  669.      */
  670.     public function setFacebookId($facebookId)
  671.     {
  672.         $this->facebookId $facebookId;
  673.         return $this;
  674.     }
  675.     /**
  676.      * Get facebookId.
  677.      *
  678.      * @return string
  679.      */
  680.     public function getFacebookId()
  681.     {
  682.         return $this->facebookId;
  683.     }
  684.     /**
  685.      * Set tempEmail.
  686.      *
  687.      * @param string $tempEmail
  688.      *
  689.      * @return Customer
  690.      */
  691.     public function setTempEmail($tempEmail)
  692.     {
  693.         $this->tempEmail $tempEmail;
  694.         return $this;
  695.     }
  696.     /**
  697.      * Get tempEmail.
  698.      *
  699.      * @return string
  700.      */
  701.     public function getTempEmail()
  702.     {
  703.         return $this->tempEmail;
  704.     }
  705.     /**
  706.      * Set tempEmailToken.
  707.      *
  708.      * @param string $tempEmailToken
  709.      *
  710.      * @return Customer
  711.      */
  712.     public function setTempEmailToken($tempEmailToken)
  713.     {
  714.         $this->tempEmailToken $tempEmailToken;
  715.         return $this;
  716.     }
  717.     /**
  718.      * Get tempEmailToken.
  719.      *
  720.      * @return string
  721.      */
  722.     public function getTempEmailToken()
  723.     {
  724.         return $this->tempEmailToken;
  725.     }
  726.     /**
  727.      * Set acceptConditions.
  728.      *
  729.      * @param string $acceptConditions
  730.      *
  731.      * @return Customer
  732.      */
  733.     public function setAcceptConditions($acceptConditions)
  734.     {
  735.         $this->acceptConditions $acceptConditions;
  736.         return $this;
  737.     }
  738.     /**
  739.      * Get acceptConditions.
  740.      *
  741.      * @return string
  742.      */
  743.     public function getAcceptConditions()
  744.     {
  745.         return $this->acceptConditions;
  746.     }
  747.     /**
  748.      * Set travelPreference.
  749.      *
  750.      * @param \Aviatur\CustomerBundle\Entity\TravelPreference $travelPreference
  751.      *
  752.      * @return Customer
  753.      */
  754.     public function setTravelPreference(\Aviatur\CustomerBundle\Entity\TravelPreference $travelPreference null)
  755.     {
  756.         $this->travelPreference $travelPreference;
  757.         return $this;
  758.     }
  759.     /**
  760.      * Get travelPreference.
  761.      *
  762.      * @return \Aviatur\CustomerBundle\Entity\TravelPreference
  763.      */
  764.     public function getTravelPreference()
  765.     {
  766.         return $this->travelPreference;
  767.     }
  768.     /**
  769.      * Set documentType.
  770.      *
  771.      * @param \Aviatur\CustomerBundle\Entity\DocumentType $documentType
  772.      *
  773.      * @return Customer
  774.      */
  775.     public function setDocumentType(\Aviatur\CustomerBundle\Entity\DocumentType $documentType null)
  776.     {
  777.         $this->documentType $documentType;
  778.         return $this;
  779.     }
  780.     /**
  781.      * Get documentType.
  782.      *
  783.      * @return \Aviatur\CustomerBundle\Entity\DocumentType
  784.      */
  785.     public function getDocumentType()
  786.     {
  787.         return $this->documentType;
  788.     }
  789.     /**
  790.      * Set civilStatus.
  791.      *
  792.      * @param \Aviatur\CustomerBundle\Entity\CivilStatus $civilStatus
  793.      *
  794.      * @return Customer
  795.      */
  796.     public function setCivilStatus(\Aviatur\CustomerBundle\Entity\CivilStatus $civilStatus null)
  797.     {
  798.         $this->civilStatus $civilStatus;
  799.         return $this;
  800.     }
  801.     /**
  802.      * Get civilStatus.
  803.      *
  804.      * @return \Aviatur\CustomerBundle\Entity\CivilStatus
  805.      */
  806.     public function getCivilStatus()
  807.     {
  808.         return $this->civilStatus;
  809.     }
  810.     /**
  811.      * Set genderAviatur.
  812.      *
  813.      * @param \Aviatur\CustomerBundle\Entity\Gender $genderAviatur
  814.      *
  815.      * @return Customer
  816.      */
  817.     public function setGenderAviatur(\Aviatur\CustomerBundle\Entity\Gender $genderAviatur null)
  818.     {
  819.         $this->genderAviatur $genderAviatur;
  820.         return $this;
  821.     }
  822.     /**
  823.      * Get genderAviatur.
  824.      *
  825.      * @return \Aviatur\CustomerBundle\Entity\Gender
  826.      */
  827.     public function getGenderAviatur()
  828.     {
  829.         return $this->genderAviatur;
  830.     }
  831.     /**
  832.      * Set city.
  833.      *
  834.      * @param \Aviatur\GeneralBundle\Entity\City $city
  835.      *
  836.      * @return Customer
  837.      */
  838.     public function setCity(\Aviatur\GeneralBundle\Entity\City $city null)
  839.     {
  840.         $this->city $city;
  841.         return $this;
  842.     }
  843.     /**
  844.      * Get city.
  845.      *
  846.      * @return \Aviatur\GeneralBundle\Entity\City
  847.      */
  848.     public function getCity()
  849.     {
  850.         return $this->city;
  851.     }
  852.     /**
  853.      * Set country.
  854.      *
  855.      * @param \Aviatur\GeneralBundle\Entity\Country $country
  856.      *
  857.      * @return Customer
  858.      */
  859.     public function setCountry(\Aviatur\GeneralBundle\Entity\Country $country null)
  860.     {
  861.         $this->country $country;
  862.         return $this;
  863.     }
  864.     /**
  865.      * Get country.
  866.      *
  867.      * @return \Aviatur\GeneralBundle\Entity\Country
  868.      */
  869.     public function getCountry()
  870.     {
  871.         return $this->country;
  872.     }
  873.     /**
  874.      * Add order.
  875.      *
  876.      * @return Customer
  877.      */
  878.     public function addOrder(\Aviatur\GeneralBundle\Entity\Order $order)
  879.     {
  880.         $this->order[] = $order;
  881.         return $this;
  882.     }
  883.     /**
  884.      * Remove order.
  885.      */
  886.     public function removeOrder(\Aviatur\GeneralBundle\Entity\Order $order)
  887.     {
  888.         $this->order->removeElement($order);
  889.     }
  890.     /**
  891.      * Get order.
  892.      *
  893.      * @return \Doctrine\Common\Collections\Collection
  894.      */
  895.     public function getOrder()
  896.     {
  897.         return $this->order;
  898.     }
  899.     /**
  900.      * Add historicalContent.
  901.      *
  902.      * @return Content
  903.      */
  904.     public function addHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  905.     {
  906.         $this->historicalContent[] = $historicalContent;
  907.         return $this;
  908.     }
  909.     /**
  910.      * Remove historicalContent.
  911.      */
  912.     public function removeHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  913.     {
  914.         $this->historicalContent->removeElement($historicalContent);
  915.     }
  916.     /**
  917.      * Get historicalContent.
  918.      *
  919.      * @return \Doctrine\Common\Collections\Collection
  920.      */
  921.     public function getHistoricalContent()
  922.     {
  923.         return $this->historicalContent;
  924.     }
  925.     /**
  926.      * Add content.
  927.      *
  928.      * @return Content
  929.      */
  930.     public function addContent(\Aviatur\ContentBundle\Entity\Content $content)
  931.     {
  932.         $this->content[] = $content;
  933.         return $this;
  934.     }
  935.     /**
  936.      * Remove content.
  937.      */
  938.     public function removeContent(\Aviatur\ContentBundle\Entity\Content $content)
  939.     {
  940.         $this->content->removeElement($content);
  941.     }
  942.     /**
  943.      * Get content.
  944.      *
  945.      * @return \Doctrine\Common\Collections\Collection
  946.      */
  947.     public function getContent()
  948.     {
  949.         return $this->content;
  950.     }
  951.     
  952.     /**
  953.      * Add agency.
  954.      *
  955.      * @return Agency
  956.      */
  957.     public function addAgency(\Aviatur\AgencyBundle\Entity\Agency $agency)
  958.     {
  959.         $this->agency[] = $agency;
  960.         return $this;
  961.     }
  962.     /**
  963.      * Remove agency.
  964.      */
  965.     public function removeAgency(\Aviatur\AgencyBundle\Entity\Agency $agency)
  966.     {
  967.         $this->agency->removeElement($agency);
  968.     }
  969.     /**
  970.      * Get agency.
  971.      *
  972.      * @return \Aviatur\AgencyBundle\Entity\Agency
  973.      */
  974.     public function getAgency()
  975.     {
  976.         return $this->agency;
  977.     }
  978.     /**
  979.      * Set agency.
  980.      *
  981.      * @param \Aviatur\AgencyBundle\Entity\Agency $agency
  982.      *
  983.      * @return Customer
  984.      */
  985.     public function setAgency(\Aviatur\AgencyBundle\Entity\Agency $agency null)
  986.     {
  987.         $this->agency $agency;
  988.         return $this;
  989.     }
  990.     /**
  991.      * Add agent.
  992.      *
  993.      * @return Agent
  994.      */
  995.     public function addAgent(\Aviatur\AgentBundle\Entity\Agent $agent)
  996.     {
  997.         $this->agent[] = $agent;
  998.         return $this;
  999.     }
  1000.     /**
  1001.      * Remove agent.
  1002.      */
  1003.     public function removeAgent(\Aviatur\AgentBundle\Entity\Agent $agent)
  1004.     {
  1005.         $this->agent->removeElement($agent);
  1006.     }
  1007.     /**
  1008.      * Get agent.
  1009.      *
  1010.      * @return \Aviatur\AgentBundle\Entity\Agent
  1011.      */
  1012.     public function getAgent()
  1013.     {
  1014.         return $this->agent;
  1015.     }
  1016.     /**
  1017.      * Set agent.
  1018.      *
  1019.      * @param \Aviatur\AgentBundle\Entity\Agent $agent
  1020.      *
  1021.      * @return Customer
  1022.      */
  1023.     public function setAgent(\Aviatur\AgentBundle\Entity\Agent $agent null)
  1024.     {
  1025.         $this->agent $agent;
  1026.         return $this;
  1027.     }
  1028.     /**
  1029.      * @ORM\PrePersist
  1030.      */
  1031.     public function validatePersist(\Doctrine\ORM\Event\LifecycleEventArgs $args)
  1032.     {
  1033.         if (empty($this->username)) {
  1034.             $this->username $this->email;
  1035.         }
  1036.         if (empty($this->usernameCanonical)) {
  1037.             $this->usernameCanonical $this->email;
  1038.         }
  1039.         if (empty($this->emailCanonical)) {
  1040.             $this->emailCanonical $this->email;
  1041.         }
  1042.         if (empty($this->password)) {
  1043.             $this->password sha1($this->PASSWORDDEFAULT);
  1044.         }
  1045.         if ($this->enabled === null) {
  1046.             $this->enabled true;
  1047.         }
  1048.         
  1049.         $customerValidator = new CustomerValidator($this);
  1050.         switch (true) {
  1051.             case!$customerValidator->validateDocumenttype():
  1052.             case!$customerValidator->validateDocumentnumber():
  1053.             case!$customerValidator->validateFirstname():
  1054.             case!$customerValidator->validateLastname():
  1055.             case!$customerValidator->validateCivilstatus():
  1056.             case!$customerValidator->validateAddress():
  1057.             case!$customerValidator->validatePhone():
  1058.             case!$customerValidator->validateEmail():
  1059.                 throw new ValidateException($customerValidator->getMessage());
  1060.             default:
  1061.                 true;
  1062.         }
  1063.         return true;
  1064.     }
  1065.     /**
  1066.      * @ORM\PreUpdate
  1067.      */
  1068.     public function validateUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
  1069.     {
  1070.         if (=== count($args->getEntityChangeSet()) && 'lastLogin' === key($args->getEntityChangeSet())) {
  1071.             return true;
  1072.         }
  1073.         $customerValidator = new CustomerValidator($this);
  1074.         switch (true) {
  1075.             case!$customerValidator->validateDocumenttype():
  1076.             case!$customerValidator->validateDocumentnumber():
  1077.             case!$customerValidator->validateFirstname():
  1078.             case!$customerValidator->validateLastname():
  1079.             case!$customerValidator->validateBirthdate():
  1080.             case!$customerValidator->validateCivilstatus():
  1081.             case!$customerValidator->validateAddress():
  1082.             case!$customerValidator->validatePhone():
  1083.             case!$customerValidator->validateEmail():
  1084.                 throw new ValidateException($customerValidator->getMessage());
  1085.             default:
  1086.                 true;
  1087.         }
  1088.         return true;
  1089.     }
  1090.     public function completeCity($em)
  1091.     {
  1092.         $dataCity $em->getRepository(\Aviatur\GeneralBundle\Entity\City::class)->findOneBy(['id' => '2164']);
  1093.         $dataCountry $em->getRepository(\Aviatur\GeneralBundle\Entity\Country::class)->findOneBy(['id' => '165']);
  1094.         $this->setCity($dataCity);
  1095.         $this->setCountry($dataCountry);
  1096.         return true;
  1097.     }
  1098. }