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