src/Entity/Rate.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Room;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity
  7.  *
  8.  * @ORM\Table(name="delivery_rate")
  9.  */
  10. class Rate
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      *
  15.      * @ORM\GeneratedValue
  16.      *
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity="App\Entity\Room", cascade={"persist"})
  22.      *
  23.      * @ORM\JoinColumn(name="room_id", nullable=false, onDelete="cascade")
  24.      */
  25.     private $room;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="Location", cascade={"persist"})
  28.      *
  29.      * @ORM\JoinColumn(name="location_id", nullable=false, onDelete="cascade")
  30.      */
  31.     private $location;
  32.     /**
  33.      * Price for category 1 vehicles.
  34.      *
  35.      * @ORM\Column(name="category_1_price", type="decimal", scale=2, nullable=true)
  36.      */
  37.     private $category1Price;
  38.     /**
  39.      * Price for category 2 vehicles.
  40.      *
  41.      * @ORM\Column(name="category_2_price", type="decimal", scale=2, nullable=true)
  42.      */
  43.     private $category2Price;
  44.     /**
  45.      * Price for non standard vehicles.
  46.      *
  47.      * @ORM\Column(name="non_standard_price", type="decimal", scale=2, nullable=true)
  48.      */
  49.     private $nonStandardPrice;
  50.     public function getId()
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function setCategory1Price($category1Price): void
  55.     {
  56.         $this->category1Price $category1Price;
  57.     }
  58.     public function getCategory1Price()
  59.     {
  60.         return $this->category1Price;
  61.     }
  62.     public function setCategory2Price($category2Price): void
  63.     {
  64.         $this->category2Price $category2Price;
  65.     }
  66.     public function getCategory2Price()
  67.     {
  68.         return $this->category2Price;
  69.     }
  70.     public function setNonStandardPrice($nonStandardPrice): void
  71.     {
  72.         $this->nonStandardPrice $nonStandardPrice;
  73.     }
  74.     public function getNonStandardPrice()
  75.     {
  76.         return $this->nonStandardPrice;
  77.     }
  78.     public function setRoom(Room $room): void
  79.     {
  80.         $this->room $room;
  81.     }
  82.     public function getRoom()
  83.     {
  84.         return $this->room;
  85.     }
  86.     public function setLocation(Location $location): void
  87.     {
  88.         $this->location $location;
  89.     }
  90.     public function getLocation()
  91.     {
  92.         return $this->location;
  93.     }
  94.     public function hasPrices()
  95.     {
  96.         return !== (int) $this->getCategory1Price()
  97.             || !== (int) $this->getCategory2Price()
  98.             || !== (int) $this->getNonStandardPrice();
  99.     }
  100.     public function hasFreeNonStandard()
  101.     {
  102.         return == (int) $this->getNonStandardPrice();
  103.     }
  104. }