src/Aviatur/CustomerBundle/Entity/TravelPreference.php line 13

Open in your IDE?
  1. <?php
  2. namespace Aviatur\CustomerBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * TravelPreference.
  6.  *
  7.  * @ORM\Table(name="travel_preference")
  8.  * @ORM\Entity
  9.  */
  10. class TravelPreference
  11. {
  12.     /**
  13.      * @var int
  14.      *
  15.      * @ORM\Column(name="id", type="integer", nullable=false)
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue(strategy="IDENTITY")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @var string
  22.      *
  23.      * @ORM\Column(name="code", type="string", length=10, nullable=false)
  24.      */
  25.     private $code;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="externalCode", type="string", length=10, nullable=false)
  30.      */
  31.     private $externalcode;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="description", type="string", length=50, nullable=false)
  36.      */
  37.     private $description;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity="Aviatur\CustomerBundle\Entity\Customer", mappedBy="travelPreference", cascade={"all"})
  40.      */
  41.     private $customer;
  42.     public function __toString()
  43.     {
  44.         $return $this->getDescription().' ('.$this->getCode().')';
  45.         return $return;
  46.     }
  47.     /**
  48.      * Constructor.
  49.      */
  50.     public function __construct()
  51.     {
  52.         $this->customer = new \Doctrine\Common\Collections\ArrayCollection();
  53.     }
  54.     /**
  55.      * Get id.
  56.      *
  57.      * @return int
  58.      */
  59.     public function getId()
  60.     {
  61.         return $this->id;
  62.     }
  63.     /**
  64.      * Set code.
  65.      *
  66.      * @param string $code
  67.      *
  68.      * @return TravelPreference
  69.      */
  70.     public function setCode($code)
  71.     {
  72.         $this->code $code;
  73.         return $this;
  74.     }
  75.     /**
  76.      * Get code.
  77.      *
  78.      * @return string
  79.      */
  80.     public function getCode()
  81.     {
  82.         return $this->code;
  83.     }
  84.     /**
  85.      * Set externalcode.
  86.      *
  87.      * @param string $externalcode
  88.      *
  89.      * @return TravelPreference
  90.      */
  91.     public function setExternalcode($externalcode)
  92.     {
  93.         $this->externalcode $externalcode;
  94.         return $this;
  95.     }
  96.     /**
  97.      * Get externalcode.
  98.      *
  99.      * @return string
  100.      */
  101.     public function getExternalcode()
  102.     {
  103.         return $this->externalcode;
  104.     }
  105.     /**
  106.      * Set description.
  107.      *
  108.      * @param string $description
  109.      *
  110.      * @return TravelPreference
  111.      */
  112.     public function setDescription($description)
  113.     {
  114.         $this->description $description;
  115.         return $this;
  116.     }
  117.     /**
  118.      * Get description.
  119.      *
  120.      * @return string
  121.      */
  122.     public function getDescription()
  123.     {
  124.         return $this->description;
  125.     }
  126.     /**
  127.      * Add customer.
  128.      *
  129.      * @return TravelPreference
  130.      */
  131.     public function addCustomer(\Aviatur\CustomerBundle\Entity\Customer $customer)
  132.     {
  133.         $this->customer[] = $customer;
  134.         return $this;
  135.     }
  136.     /**
  137.      * Remove customer.
  138.      */
  139.     public function removeCustomer(\Aviatur\CustomerBundle\Entity\Customer $customer)
  140.     {
  141.         $this->customer->removeElement($customer);
  142.     }
  143.     /**
  144.      * Get customer.
  145.      *
  146.      * @return \Doctrine\Common\Collections\Collection
  147.      */
  148.     public function getCustomer()
  149.     {
  150.         return $this->customer;
  151.     }
  152. }