154 lines
2.9 KiB
PHP
154 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="invoice_item")
|
|
*/
|
|
class InvoiceItem
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// invoice the item is linked to
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Invoice", inversedBy="items")
|
|
* @ORM\JoinColumn(name="invoice_id", referencedColumnName="id")
|
|
*/
|
|
protected $invoice;
|
|
|
|
// title of item
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
*/
|
|
protected $title;
|
|
|
|
// quantity
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
*/
|
|
protected $qty;
|
|
|
|
// price of item, negative for discounts
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=9, scale=2)
|
|
*/
|
|
protected $price;
|
|
|
|
// battery the item is linked to
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Battery")
|
|
* @ORM\JoinColumn(name="battery_id", referencedColumnName="id")
|
|
*/
|
|
protected $battery;
|
|
|
|
// battery size for trade in items
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="BatterySize")
|
|
* @ORM\JoinColumn(name="battery_size_id", referencedColumnName="id")
|
|
*/
|
|
protected $battery_size;
|
|
|
|
// trade in type
|
|
/**
|
|
* @ORM\Column(type="string", length=20)
|
|
*/
|
|
protected $trade_in_type;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->title = '';
|
|
$this->price = 0.0;
|
|
$this->trade_in_type = '';
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setInvoice(Invoice $invoice)
|
|
{
|
|
$this->invoice = $invoice;
|
|
return $this;
|
|
}
|
|
|
|
public function getInvoice()
|
|
{
|
|
return $this->invoice;
|
|
}
|
|
|
|
public function setTitle($title)
|
|
{
|
|
$this->title = $title;
|
|
return $this;
|
|
}
|
|
|
|
public function getTitle()
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setQuantity($qty)
|
|
{
|
|
$this->qty = $qty;
|
|
return $this;
|
|
}
|
|
|
|
public function getQuantity()
|
|
{
|
|
return $this->qty;
|
|
}
|
|
|
|
public function setPrice($price)
|
|
{
|
|
$this->price = $price;
|
|
return $this;
|
|
}
|
|
|
|
public function getPrice()
|
|
{
|
|
return $this->price;
|
|
}
|
|
|
|
public function setBattery(Battery $battery)
|
|
{
|
|
$this->battery = $battery;
|
|
return $this;
|
|
}
|
|
|
|
public function getBattery()
|
|
{
|
|
return $this->battery;
|
|
}
|
|
|
|
public function setBatterySize(BatterySize $battery_size)
|
|
{
|
|
$this->battery_size = $battery_size;
|
|
return $this;
|
|
}
|
|
|
|
public function getBatterySize()
|
|
{
|
|
return $this->battery_size;
|
|
}
|
|
|
|
public function setTradeInType(string $trade_in_type)
|
|
{
|
|
$this->trade_in_type = $trade_in_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getTradeInType()
|
|
{
|
|
return $this->trade_in_type;
|
|
}
|
|
}
|