src/Uniski/ResourceBundle/Entity/InsuranceRate.php line 11

Open in your IDE?
  1. <?php
  2. namespace Uniski\ResourceBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Uniski\CommerceBundle\Exception\PriceNotFoundException;
  5. /**
  6. * @ORM\Entity
  7. **/
  8. class InsuranceRate extends PriceRate
  9. {
  10.   const PRICE_MAIN_KEY 'prices';
  11.   /**
  12.    * @var   \Doctrine\Common\Collections\ArrayCollection
  13.    * @ORM\ManyToOne(targetEntity="Uniski\ConfigBundle\Entity\Category")
  14.    *
  15.    */
  16.   protected $zone;
  17.   /**
  18.    * @var   Insurance
  19.    * @ORM\ManyToOne(targetEntity="Insurance", inversedBy="rates")
  20.    *
  21.    */
  22.   protected $insurance;
  23.     /**
  24.      * Set zone
  25.      *
  26.      * @param \Uniski\ConfigBundle\Entity\Category $zone
  27.      *
  28.      * @return InsuranceRate
  29.      */
  30.     public function setZone(\Uniski\ConfigBundle\Entity\Category $zone null)
  31.     {
  32.         $this->zone $zone;
  33.         return $this;
  34.     }
  35.     /**
  36.      * Get zone
  37.      *
  38.      * @return \Uniski\ConfigBundle\Entity\Category
  39.      */
  40.     public function getZone()
  41.     {
  42.         return $this->zone;
  43.     }
  44.     /**
  45.      * Set insurance
  46.      *
  47.      * @param \Uniski\ResourceBundle\Entity\Insurance $insurance
  48.      *
  49.      * @return InsuranceRate
  50.      */
  51.     public function setInsurance(\Uniski\ResourceBundle\Entity\Insurance $insurance null)
  52.     {
  53.         $this->insurance $insurance;
  54.         return $this;
  55.     }
  56.     /**
  57.      * Get insurance
  58.      *
  59.      * @return \Uniski\ResourceBundle\Entity\Insurance
  60.      */
  61.     public function getInsurance()
  62.     {
  63.         return $this->insurance;
  64.     }
  65.     public static function getModel($options null)
  66.     {
  67.       $days = [=> ''=> ''=> ''=> ''=> ''=> '',
  68.                => ''=> ''=> ''10 => ''11 => ''12 => '',
  69.                13 => ''14 => ''15 => ''16 => ''];
  70.       return [
  71.         self::PRICE_MAIN_KEY => $days
  72.       ];
  73.     }
  74.     public function getPrice($days)
  75.     {
  76.       if ($this->prices != null && isset($this->prices[self::PRICE_MAIN_KEY][$days])) return $this->prices[self::PRICE_MAIN_KEY][$days];
  77.       throw new PriceNotFoundException();
  78.     }
  79. }