src/Entity/QuoteItems.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * QuoteItems
  6.  *
  7.  * @ORM\Table(name="quote_items", indexes={@ORM\Index(name="quote_id", columns={"quote_id"})})
  8.  * @ORM\Entity
  9.  */
  10. class QuoteItems
  11. {
  12.     const PAINT = 0;
  13.     const ASSEMBLY = 1;
  14.     const BODYGUARD = 2;
  15.     const OTHER = 3;
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer", nullable=false)
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="IDENTITY")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var int
  26.      *
  27.      * @ORM\Column(name="type", type="integer", nullable=false)
  28.      */
  29.     private $type;
  30.     /**
  31.      * @var int|null
  32.      *
  33.      * @ORM\Column(name="price_qty", type="integer", nullable=true)
  34.      */
  35.     private $priceQty;
  36.     /**
  37.      * @var int|null
  38.      *
  39.      * @ORM\Column(name="qty", type="float", nullable=true)
  40.      */
  41.     private $qty;
  42.     /**
  43.      * @var int|null
  44.      *
  45.      * @ORM\Column(name="price_sum", type="integer", nullable=true)
  46.      */
  47.     private $priceSum;
  48.     /**
  49.      * @var string|null
  50.      *
  51.      * @ORM\Column(name="note", type="text", length=65535, nullable=true)
  52.      */
  53.     private $note;
  54.     /**
  55.      * @var \DateTime
  56.      *
  57.      * @ORM\Column(name="created", type="datetime", nullable=false)
  58.      */
  59.     private $created;
  60.     /**
  61.      * @var \Quotes
  62.      *
  63.      * @ORM\ManyToOne(targetEntity="Quotes", cascade={"persist"})
  64.      * @ORM\JoinColumns({
  65.      *   @ORM\JoinColumn(name="quote_id", referencedColumnName="id")
  66.      * })
  67.      */
  68.     private $quote;
  69.     /**
  70.      * @var \DateTime
  71.      *
  72.      * @ORM\Column(name="modified", type="datetime", nullable=true, options={"comment"="Módosítva"})
  73.      */
  74.     private $modified;
  75.     public function __construct()
  76.     {
  77.         $this->created = new \DateTime();
  78.         $this->type = 0;
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getType(): ?int
  85.     {
  86.         return $this->type;
  87.     }
  88.     public function setType(int $type): self
  89.     {
  90.         $this->type = $type;
  91.         return $this;
  92.     }
  93.     public function getPriceQty(): ?int
  94.     {
  95.         return $this->priceQty;
  96.     }
  97.     public function setPriceQty(?int $priceQty): self
  98.     {
  99.         $this->priceQty = $priceQty;
  100.         return $this;
  101.     }
  102.     public function getQty(): ?float
  103.     {
  104.         return $this->qty;
  105.     }
  106.     public function setQty(?float $qty): self
  107.     {
  108.         $this->qty = $qty;
  109.         return $this;
  110.     }
  111.     public function getPriceSum(): ?int
  112.     {
  113.         return $this->priceSum;
  114.     }
  115.     public function setPriceSum(?int $priceSum): self
  116.     {
  117.         $this->priceSum = $priceSum;
  118.         return $this;
  119.     }
  120.     public function getNote(): ?string
  121.     {
  122.         return $this->note;
  123.     }
  124.     public function setNote(?string $note): self
  125.     {
  126.         $this->note = $note;
  127.         return $this;
  128.     }
  129.     public function getCreated(): ?\DateTimeInterface
  130.     {
  131.         return $this->created;
  132.     }
  133.     public function setCreated(\DateTimeInterface $created): self
  134.     {
  135.         $this->created = $created;
  136.         return $this;
  137.     }
  138.     public function getQuote(): ?Quotes
  139.     {
  140.         return $this->quote;
  141.     }
  142.     public function setQuote(?Quotes $quote): self
  143.     {
  144.         $this->quote = $quote;
  145.         return $this;
  146.     }
  147.     public function __toString()
  148.     {
  149.         return $this->note;
  150.     }
  151.     public function getQtyType()
  152.     {
  153.         switch ($this->type) {
  154.             case QuoteItems::PAINT:
  155.             case QuoteItems::ASSEMBLY:
  156.             case QuoteItems::BODYGUARD:
  157.                 return 'Work hour';
  158.                 break;
  159.             case QuoteItems::OTHER:
  160.                 return 'Quantity';
  161.                 break;
  162.             default:
  163.                 return 'Quantity';
  164.         }
  165.     }
  166.     public function getQtyPriceType()
  167.     {
  168.         switch ($this->type) {
  169.             case QuoteItems::PAINT:
  170.             case QuoteItems::ASSEMBLY:
  171.             case QuoteItems::BODYGUARD:
  172.                 return 'Hourly rate';
  173.                 break;
  174.             case QuoteItems::OTHER:
  175.                 return 'Unit price';
  176.                 break;
  177.             default:
  178.                 return 'Unit price';
  179.         }
  180.     }
  181.     public function getModified(): ?\DateTimeInterface
  182.     {
  183.         return $this->modified;
  184.     }
  185. }