<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'quote_items', indexes: [new ORM\Index(name: 'quote_id', columns: ['quote_id'])])]
#[ORM\Entity]
class QuoteItems
{
const PAINT = 0;
const ASSEMBLY = 1;
const BODYGUARD = 2;
const OTHER = 3;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
#[ORM\Column(name: 'type', type: 'integer', nullable: false)]
private $type;
#[ORM\Column(name: 'price_qty', type: 'integer', nullable: true)]
private $priceQty;
#[ORM\Column(name: 'qty', type: 'float', nullable: true)]
private $qty;
#[ORM\Column(name: 'price_sum', type: 'integer', nullable: true)]
private $priceSum;
#[ORM\Column(name: 'note', type: 'text', length: 65535, nullable: true)]
private $note;
#[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
private $created;
#[ORM\ManyToOne(targetEntity: 'Quotes', cascade: ['persist'], inversedBy: 'quoteItems')]
#[ORM\JoinColumn(name: 'quote_id', referencedColumnName: 'id')]
private $quote;
#[ORM\Column(name: 'modified', type: 'datetime', nullable: true, options: ['comment' => 'Módosítva'])]
private $modified;
public function __construct()
{
$this->created = new \DateTime();
$this->type = 0;
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function getPriceQty(): ?int
{
return $this->priceQty;
}
public function setPriceQty(?int $priceQty): self
{
$this->priceQty = $priceQty;
return $this;
}
public function getQty(): ?float
{
return $this->qty;
}
public function setQty(?float $qty): self
{
$this->qty = $qty;
return $this;
}
public function getPriceSum(): ?int
{
return $this->priceSum;
}
public function setPriceSum(?int $priceSum): self
{
$this->priceSum = $priceSum;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getQuote(): ?Quotes
{
return $this->quote;
}
public function setQuote(?Quotes $quote): self
{
$this->quote = $quote;
return $this;
}
public function __toString(){
return $this->note;
}
public function getQtyType(){
switch ($this->type) {
case QuoteItems::PAINT:
case QuoteItems::ASSEMBLY:
case QuoteItems::BODYGUARD:
return "Munkaóra";
break;
case QuoteItems::OTHER:
return "Darab";
break;
}
}
public function getQtyPriceType(){
switch ($this->type) {
case QuoteItems::PAINT:
case QuoteItems::ASSEMBLY:
case QuoteItems::BODYGUARD:
return "Óradíj";
break;
case QuoteItems::OTHER:
return "Egységár";
break;
}
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
}