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.     public function setCustomerPassword($password){
  307.         $this->password $password;
  308.         return $this;
  309.     }
  310.     /**
  311.      * Set documentnumber.
  312.      *
  313.      * @param string $documentnumber
  314.      *
  315.      * @return Customer
  316.      */
  317.     public function setDocumentnumber($documentnumber)
  318.     {
  319.         $this->documentnumber $documentnumber;
  320.         return $this;
  321.     }
  322.     /**
  323.      * Get documentnumber.
  324.      *
  325.      * @return string
  326.      */
  327.     public function getDocumentnumber()
  328.     {
  329.         return $this->documentnumber;
  330.     }
  331.     /**
  332.      * Set firstname.
  333.      *
  334.      * @param string $firstname
  335.      *
  336.      * @return Customer
  337.      */
  338.     public function setFirstname($firstname)
  339.     {
  340.         $this->firstname $firstname;
  341.         return $this;
  342.     }
  343.     /**
  344.      * Get firstname.
  345.      *
  346.      * @return string
  347.      */
  348.     public function getFirstname()
  349.     {
  350.         return $this->firstname;
  351.     }
  352.     /**
  353.      * Set lastname.
  354.      *
  355.      * @param string $lastname
  356.      *
  357.      * @return Customer
  358.      */
  359.     public function setLastname($lastname)
  360.     {
  361.         $this->lastname $lastname;
  362.         return $this;
  363.     }
  364.     /**
  365.      * Get lastname.
  366.      *
  367.      * @return string
  368.      */
  369.     public function getLastname()
  370.     {
  371.         return $this->lastname;
  372.     }
  373.     /**
  374.      * Set birthdate.
  375.      *
  376.      * @param \DateTime $birthdate
  377.      *
  378.      * @return Customer
  379.      */
  380.     public function setBirthdate($birthdate)
  381.     {
  382.         $this->birthdate $birthdate;
  383.         return $this;
  384.     }
  385.     /**
  386.      * Get birthdate.
  387.      *
  388.      * @return \DateTime
  389.      */
  390.     public function getBirthdate()
  391.     {
  392.         return $this->birthdate;
  393.     }
  394.     /**
  395.      * Set address.
  396.      *
  397.      * @param string $address
  398.      *
  399.      * @return Customer
  400.      */
  401.     public function setAddress($address)
  402.     {
  403.         $this->address $address;
  404.         return $this;
  405.     }
  406.     /**
  407.      * Get address.
  408.      *
  409.      * @return string
  410.      */
  411.     public function getAddress()
  412.     {
  413.         return $this->address;
  414.     }
  415.     /**
  416.      * Set phone.
  417.      *
  418.      * @param string $phone
  419.      *
  420.      * @return Customer
  421.      */
  422.     public function setPhone($phone)
  423.     {
  424.         $this->phone $phone;
  425.         return $this;
  426.     }
  427.     /**
  428.      * Get phone.
  429.      *
  430.      * @return string
  431.      */
  432.     public function getPhone()
  433.     {
  434.         return $this->phone;
  435.     }
  436.     /**
  437.      * Set cellphone.
  438.      *
  439.      * @param string $cellphone
  440.      *
  441.      * @return Customer
  442.      */
  443.     public function setCellphone($cellphone)
  444.     {
  445.         $this->cellphone $cellphone;
  446.         return $this;
  447.     }
  448.     /**
  449.      * Get cellphone.
  450.      *
  451.      * @return string
  452.      */
  453.     public function getCellphone()
  454.     {
  455.         return $this->cellphone;
  456.     }
  457.     /**
  458.      * Set email.
  459.      *
  460.      * @param string $email
  461.      *
  462.      * @return Customer
  463.      */
  464.     public function setEmail($email)
  465.     {
  466.         $this->email $email;
  467.         return $this;
  468.     }
  469.     /**
  470.      * Get email.
  471.      *
  472.      * @return string
  473.      */
  474.     public function getEmail()
  475.     {
  476.         return $this->email;
  477.     }
  478.     /**
  479.      * Set enabled.
  480.      *
  481.      * @param string $enabled
  482.      *
  483.      * @return Customer
  484.      */
  485.     public function setEnabled($enabled)
  486.     {
  487.         $this->enabled $enabled;
  488.         return $this;
  489.     }
  490.     /**
  491.      * Get enabled.
  492.      *
  493.      * @return string
  494.      */
  495.     public function getEnabled()
  496.     {
  497.         return $this->enabled;
  498.     }
  499.     /**
  500.      * Set acceptinformation.
  501.      *
  502.      * @param int $acceptinformation
  503.      *
  504.      * @return Customer
  505.      */
  506.     public function setAcceptinformation($acceptinformation)
  507.     {
  508.         $this->acceptinformation $acceptinformation;
  509.         return $this;
  510.     }
  511.     /**
  512.      * Get acceptinformation.
  513.      *
  514.      * @return int
  515.      */
  516.     public function getAcceptinformation()
  517.     {
  518.         return $this->acceptinformation;
  519.     }
  520.     /**
  521.      * Set acceptsms.
  522.      *
  523.      * @param int $acceptsms
  524.      *
  525.      * @return Customer
  526.      */
  527.     public function setAcceptsms($acceptsms)
  528.     {
  529.         $this->acceptsms $acceptsms;
  530.         return $this;
  531.     }
  532.     /**
  533.      * Get acceptsms.
  534.      *
  535.      * @return int
  536.      */
  537.     public function getAcceptsms()
  538.     {
  539.         return $this->acceptsms;
  540.     }
  541.     /**
  542.      * Set persontype.
  543.      *
  544.      * @param int $persontype
  545.      *
  546.      * @return Customer
  547.      */
  548.     public function setPersontype($persontype)
  549.     {
  550.         $this->persontype $persontype;
  551.         return $this;
  552.     }
  553.     /**
  554.      * Get persontype.
  555.      *
  556.      * @return int
  557.      */
  558.     public function getPersontype()
  559.     {
  560.         return $this->persontype;
  561.     }
  562.     /**
  563.      * Set corporateid.
  564.      *
  565.      * @param string $corporateid
  566.      *
  567.      * @return Customer
  568.      */
  569.     public function setCorporateid($corporateid)
  570.     {
  571.         $this->corporateid $corporateid;
  572.         return $this;
  573.     }
  574.     /**
  575.      * Get corporateid.
  576.      *
  577.      * @return string
  578.      */
  579.     public function getCorporateid()
  580.     {
  581.         return $this->corporateid;
  582.     }
  583.     /**
  584.      * Set corporatename.
  585.      *
  586.      * @param string $corporatename
  587.      *
  588.      * @return Customer
  589.      */
  590.     public function setCorporatename($corporatename)
  591.     {
  592.         $this->corporatename $corporatename;
  593.         return $this;
  594.     }
  595.     /**
  596.      * Get corporatename.
  597.      *
  598.      * @return string
  599.      */
  600.     public function getCorporatename()
  601.     {
  602.         return $this->corporatename;
  603.     }
  604.     /**
  605.      * Set frecuencysms.
  606.      *
  607.      * @param int $frecuencysms
  608.      *
  609.      * @return Customer
  610.      */
  611.     public function setFrecuencysms($frecuencysms)
  612.     {
  613.         $this->frecuencysms $frecuencysms;
  614.         return $this;
  615.     }
  616.     /**
  617.      * Get frecuencysms.
  618.      *
  619.      * @return int
  620.      */
  621.     public function getFrecuencysms()
  622.     {
  623.         return $this->frecuencysms;
  624.     }
  625.     /**
  626.      * Set hash.
  627.      *
  628.      * @param string $hash
  629.      *
  630.      * @return Customer
  631.      */
  632.     public function setHash($hash)
  633.     {
  634.         $this->hash $hash;
  635.         return $this;
  636.     }
  637.     /**
  638.      * Get hash.
  639.      *
  640.      * @return string
  641.      */
  642.     public function getHash()
  643.     {
  644.         return $this->hash;
  645.     }
  646.     /**
  647.      * Set googleId.
  648.      *
  649.      * @param string $googleId
  650.      *
  651.      * @return Customer
  652.      */
  653.     public function setGoogleId($googleId)
  654.     {
  655.         $this->googleId $googleId;
  656.         return $this;
  657.     }
  658.     /**
  659.      * Get googleId.
  660.      *
  661.      * @return string
  662.      */
  663.     public function getGoogleId()
  664.     {
  665.         return $this->googleId;
  666.     }
  667.     /**
  668.      * Set facebookId.
  669.      *
  670.      * @param string $facebookId
  671.      *
  672.      * @return Customer
  673.      */
  674.     public function setFacebookId($facebookId)
  675.     {
  676.         $this->facebookId $facebookId;
  677.         return $this;
  678.     }
  679.     /**
  680.      * Get facebookId.
  681.      *
  682.      * @return string
  683.      */
  684.     public function getFacebookId()
  685.     {
  686.         return $this->facebookId;
  687.     }
  688.     /**
  689.      * Set tempEmail.
  690.      *
  691.      * @param string $tempEmail
  692.      *
  693.      * @return Customer
  694.      */
  695.     public function setTempEmail($tempEmail)
  696.     {
  697.         $this->tempEmail $tempEmail;
  698.         return $this;
  699.     }
  700.     /**
  701.      * Get tempEmail.
  702.      *
  703.      * @return string
  704.      */
  705.     public function getTempEmail()
  706.     {
  707.         return $this->tempEmail;
  708.     }
  709.     /**
  710.      * Set tempEmailToken.
  711.      *
  712.      * @param string $tempEmailToken
  713.      *
  714.      * @return Customer
  715.      */
  716.     public function setTempEmailToken($tempEmailToken)
  717.     {
  718.         $this->tempEmailToken $tempEmailToken;
  719.         return $this;
  720.     }
  721.     /**
  722.      * Get tempEmailToken.
  723.      *
  724.      * @return string
  725.      */
  726.     public function getTempEmailToken()
  727.     {
  728.         return $this->tempEmailToken;
  729.     }
  730.     /**
  731.      * Set acceptConditions.
  732.      *
  733.      * @param string $acceptConditions
  734.      *
  735.      * @return Customer
  736.      */
  737.     public function setAcceptConditions($acceptConditions)
  738.     {
  739.         $this->acceptConditions $acceptConditions;
  740.         return $this;
  741.     }
  742.     /**
  743.      * Get acceptConditions.
  744.      *
  745.      * @return string
  746.      */
  747.     public function getAcceptConditions()
  748.     {
  749.         return $this->acceptConditions;
  750.     }
  751.     /**
  752.      * Set travelPreference.
  753.      *
  754.      * @param \Aviatur\CustomerBundle\Entity\TravelPreference $travelPreference
  755.      *
  756.      * @return Customer
  757.      */
  758.     public function setTravelPreference(\Aviatur\CustomerBundle\Entity\TravelPreference $travelPreference null)
  759.     {
  760.         $this->travelPreference $travelPreference;
  761.         return $this;
  762.     }
  763.     /**
  764.      * Get travelPreference.
  765.      *
  766.      * @return \Aviatur\CustomerBundle\Entity\TravelPreference
  767.      */
  768.     public function getTravelPreference()
  769.     {
  770.         return $this->travelPreference;
  771.     }
  772.     /**
  773.      * Set documentType.
  774.      *
  775.      * @param \Aviatur\CustomerBundle\Entity\DocumentType $documentType
  776.      *
  777.      * @return Customer
  778.      */
  779.     public function setDocumentType(\Aviatur\CustomerBundle\Entity\DocumentType $documentType null)
  780.     {
  781.         $this->documentType $documentType;
  782.         return $this;
  783.     }
  784.     /**
  785.      * Get documentType.
  786.      *
  787.      * @return \Aviatur\CustomerBundle\Entity\DocumentType
  788.      */
  789.     public function getDocumentType()
  790.     {
  791.         return $this->documentType;
  792.     }
  793.     /**
  794.      * Set civilStatus.
  795.      *
  796.      * @param \Aviatur\CustomerBundle\Entity\CivilStatus $civilStatus
  797.      *
  798.      * @return Customer
  799.      */
  800.     public function setCivilStatus(\Aviatur\CustomerBundle\Entity\CivilStatus $civilStatus null)
  801.     {
  802.         $this->civilStatus $civilStatus;
  803.         return $this;
  804.     }
  805.     /**
  806.      * Get civilStatus.
  807.      *
  808.      * @return \Aviatur\CustomerBundle\Entity\CivilStatus
  809.      */
  810.     public function getCivilStatus()
  811.     {
  812.         return $this->civilStatus;
  813.     }
  814.     /**
  815.      * Set genderAviatur.
  816.      *
  817.      * @param \Aviatur\CustomerBundle\Entity\Gender $genderAviatur
  818.      *
  819.      * @return Customer
  820.      */
  821.     public function setGenderAviatur(\Aviatur\CustomerBundle\Entity\Gender $genderAviatur null)
  822.     {
  823.         $this->genderAviatur $genderAviatur;
  824.         return $this;
  825.     }
  826.     /**
  827.      * Get genderAviatur.
  828.      *
  829.      * @return \Aviatur\CustomerBundle\Entity\Gender
  830.      */
  831.     public function getGenderAviatur()
  832.     {
  833.         return $this->genderAviatur;
  834.     }
  835.     /**
  836.      * Set city.
  837.      *
  838.      * @param \Aviatur\GeneralBundle\Entity\City $city
  839.      *
  840.      * @return Customer
  841.      */
  842.     public function setCity(\Aviatur\GeneralBundle\Entity\City $city null)
  843.     {
  844.         $this->city $city;
  845.         return $this;
  846.     }
  847.     /**
  848.      * Get city.
  849.      *
  850.      * @return \Aviatur\GeneralBundle\Entity\City
  851.      */
  852.     public function getCity()
  853.     {
  854.         return $this->city;
  855.     }
  856.     /**
  857.      * Set country.
  858.      *
  859.      * @param \Aviatur\GeneralBundle\Entity\Country $country
  860.      *
  861.      * @return Customer
  862.      */
  863.     public function setCountry(\Aviatur\GeneralBundle\Entity\Country $country null)
  864.     {
  865.         $this->country $country;
  866.         return $this;
  867.     }
  868.     /**
  869.      * Get country.
  870.      *
  871.      * @return \Aviatur\GeneralBundle\Entity\Country
  872.      */
  873.     public function getCountry()
  874.     {
  875.         return $this->country;
  876.     }
  877.     /**
  878.      * Add order.
  879.      *
  880.      * @return Customer
  881.      */
  882.     public function addOrder(\Aviatur\GeneralBundle\Entity\Order $order)
  883.     {
  884.         $this->order[] = $order;
  885.         return $this;
  886.     }
  887.     /**
  888.      * Remove order.
  889.      */
  890.     public function removeOrder(\Aviatur\GeneralBundle\Entity\Order $order)
  891.     {
  892.         $this->order->removeElement($order);
  893.     }
  894.     /**
  895.      * Get order.
  896.      *
  897.      * @return \Doctrine\Common\Collections\Collection
  898.      */
  899.     public function getOrder()
  900.     {
  901.         return $this->order;
  902.     }
  903.     /**
  904.      * Add historicalContent.
  905.      *
  906.      * @return Content
  907.      */
  908.     public function addHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  909.     {
  910.         $this->historicalContent[] = $historicalContent;
  911.         return $this;
  912.     }
  913.     /**
  914.      * Remove historicalContent.
  915.      */
  916.     public function removeHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  917.     {
  918.         $this->historicalContent->removeElement($historicalContent);
  919.     }
  920.     /**
  921.      * Get historicalContent.
  922.      *
  923.      * @return \Doctrine\Common\Collections\Collection
  924.      */
  925.     public function getHistoricalContent()
  926.     {
  927.         return $this->historicalContent;
  928.     }
  929.     /**
  930.      * Add content.
  931.      *
  932.      * @return Content
  933.      */
  934.     public function addContent(\Aviatur\ContentBundle\Entity\Content $content)
  935.     {
  936.         $this->content[] = $content;
  937.         return $this;
  938.     }
  939.     /**
  940.      * Remove content.
  941.      */
  942.     public function removeContent(\Aviatur\ContentBundle\Entity\Content $content)
  943.     {
  944.         $this->content->removeElement($content);
  945.     }
  946.     /**
  947.      * Get content.
  948.      *
  949.      * @return \Doctrine\Common\Collections\Collection
  950.      */
  951.     public function getContent()
  952.     {
  953.         return $this->content;
  954.     }
  955.     
  956.     /**
  957.      * Add agency.
  958.      *
  959.      * @return Agency
  960.      */
  961.     public function addAgency(\Aviatur\AgencyBundle\Entity\Agency $agency)
  962.     {
  963.         $this->agency[] = $agency;
  964.         return $this;
  965.     }
  966.     /**
  967.      * Remove agency.
  968.      */
  969.     public function removeAgency(\Aviatur\AgencyBundle\Entity\Agency $agency)
  970.     {
  971.         $this->agency->removeElement($agency);
  972.     }
  973.     /**
  974.      * Get agency.
  975.      *
  976.      * @return \Aviatur\AgencyBundle\Entity\Agency
  977.      */
  978.     public function getAgency()
  979.     {
  980.         return $this->agency;
  981.     }
  982.     /**
  983.      * Set agency.
  984.      *
  985.      * @param \Aviatur\AgencyBundle\Entity\Agency $agency
  986.      *
  987.      * @return Customer
  988.      */
  989.     public function setAgency(\Aviatur\AgencyBundle\Entity\Agency $agency null)
  990.     {
  991.         $this->agency $agency;
  992.         return $this;
  993.     }
  994.     /**
  995.      * Add agent.
  996.      *
  997.      * @return Agent
  998.      */
  999.     public function addAgent(\Aviatur\AgentBundle\Entity\Agent $agent)
  1000.     {
  1001.         $this->agent[] = $agent;
  1002.         return $this;
  1003.     }
  1004.     /**
  1005.      * Remove agent.
  1006.      */
  1007.     public function removeAgent(\Aviatur\AgentBundle\Entity\Agent $agent)
  1008.     {
  1009.         $this->agent->removeElement($agent);
  1010.     }
  1011.     /**
  1012.      * Get agent.
  1013.      *
  1014.      * @return \Aviatur\AgentBundle\Entity\Agent
  1015.      */
  1016.     public function getAgent()
  1017.     {
  1018.         return $this->agent;
  1019.     }
  1020.     /**
  1021.      * Set agent.
  1022.      *
  1023.      * @param \Aviatur\AgentBundle\Entity\Agent $agent
  1024.      *
  1025.      * @return Customer
  1026.      */
  1027.     public function setAgent(\Aviatur\AgentBundle\Entity\Agent $agent null)
  1028.     {
  1029.         $this->agent $agent;
  1030.         return $this;
  1031.     }
  1032.     /**
  1033.      * @ORM\PrePersist
  1034.      */
  1035.     public function validatePersist(\Doctrine\ORM\Event\LifecycleEventArgs $args)
  1036.     {
  1037.         if (empty($this->username)) {
  1038.             $this->username $this->email;
  1039.         }
  1040.         if (empty($this->usernameCanonical)) {
  1041.             $this->usernameCanonical $this->email;
  1042.         }
  1043.         if (empty($this->emailCanonical)) {
  1044.             $this->emailCanonical $this->email;
  1045.         }
  1046.         if (empty($this->password)) {
  1047.             $this->password sha1($this->PASSWORDDEFAULT);
  1048.         }
  1049.         if ($this->enabled === null) {
  1050.             $this->enabled true;
  1051.         }
  1052.         
  1053.         $customerValidator = new CustomerValidator($this);
  1054.         switch (true) {
  1055.             case!$customerValidator->validateDocumenttype():
  1056.             case!$customerValidator->validateDocumentnumber():
  1057.             case!$customerValidator->validateFirstname():
  1058.             case!$customerValidator->validateLastname():
  1059.             case!$customerValidator->validateCivilstatus():
  1060.             case!$customerValidator->validateAddress():
  1061.             case!$customerValidator->validatePhone():
  1062.             case!$customerValidator->validateEmail():
  1063.                 throw new ValidateException($customerValidator->getMessage());
  1064.             default:
  1065.                 true;
  1066.         }
  1067.         return true;
  1068.     }
  1069.     /**
  1070.      * @ORM\PreUpdate
  1071.      */
  1072.     public function validateUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $args)
  1073.     {
  1074.         if (=== count($args->getEntityChangeSet()) && 'lastLogin' === key($args->getEntityChangeSet())) {
  1075.             return true;
  1076.         }
  1077.         $customerValidator = new CustomerValidator($this);
  1078.         switch (true) {
  1079.             case!$customerValidator->validateDocumenttype():
  1080.             case!$customerValidator->validateDocumentnumber():
  1081.             case!$customerValidator->validateFirstname():
  1082.             case!$customerValidator->validateLastname():
  1083.             case!$customerValidator->validateBirthdate():
  1084.             case!$customerValidator->validateCivilstatus():
  1085.             case!$customerValidator->validateAddress():
  1086.             case!$customerValidator->validatePhone():
  1087.             case!$customerValidator->validateEmail():
  1088.                 throw new ValidateException($customerValidator->getMessage());
  1089.             default:
  1090.                 true;
  1091.         }
  1092.         return true;
  1093.     }
  1094.     public function completeCity($em)
  1095.     {
  1096.         $dataCity $em->getRepository(\Aviatur\GeneralBundle\Entity\City::class)->findOneBy(['id' => '2164']);
  1097.         $dataCountry $em->getRepository(\Aviatur\GeneralBundle\Entity\Country::class)->findOneBy(['id' => '165']);
  1098.         $this->setCity($dataCity);
  1099.         $this->setCountry($dataCountry);
  1100.         return true;
  1101.     }
  1102. }