361 lines
7.1 KiB
PHP
361 lines
7.1 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="battery")
|
|
*/
|
|
class Battery
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// manufacturer
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="BatteryManufacturer", inversedBy="batteries")
|
|
* @ORM\JoinColumn(name="manufacturer_id", referencedColumnName="id")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $manufacturer;
|
|
|
|
// model
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="BatteryModel", inversedBy="batteries")
|
|
* @ORM\JoinColumn(name="model_id", referencedColumnName="id")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $model;
|
|
|
|
// size
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="BatterySize", inversedBy="batteries")
|
|
* @ORM\JoinColumn(name="size_id", referencedColumnName="id")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $size;
|
|
|
|
// vehicle
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity="Vehicle", inversedBy="batteries", indexBy="id")
|
|
* @ORM\JoinTable(name="battery_vehicle")
|
|
*/
|
|
protected $vehicles;
|
|
|
|
// customer vehicles
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="CustomerVehicle", mappedBy="curr_battery")
|
|
*/
|
|
protected $cust_vehicles;
|
|
|
|
// product code
|
|
/**
|
|
* @ORM\Column(type="string", length=80, nullable=true)
|
|
*/
|
|
protected $prod_code;
|
|
|
|
// sap code
|
|
/**
|
|
* @ORM\Column(type="string", length=80, nullable=true)
|
|
*/
|
|
protected $sap_code;
|
|
|
|
// warranty personal
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $warr_private;
|
|
|
|
// warranty commercial
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $warr_commercial;
|
|
|
|
// warranty tnv
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $warr_tnv;
|
|
|
|
// reserve capacity
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $res_capacity;
|
|
|
|
// length
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
*/
|
|
protected $length;
|
|
|
|
// width
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
*/
|
|
protected $width;
|
|
|
|
// height
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
*/
|
|
protected $height;
|
|
|
|
// total height
|
|
/**
|
|
* @ORM\Column(type="smallint")
|
|
*/
|
|
protected $total_height;
|
|
|
|
// selling price (vat inclusive)
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2, nullable=true)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Range(min=0, minMessage="This value should be a valid number.")
|
|
*/
|
|
protected $sell_price;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", nullable=true)
|
|
*/
|
|
protected $image_file;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->vehicles = new ArrayCollection();
|
|
$this->cust_vehicles = new ArrayCollection();
|
|
|
|
$this->res_capacity = 0;
|
|
$this->length = 0;
|
|
$this->width = 0;
|
|
$this->height = 0;
|
|
$this->total_height = 0;
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setManufacturer($manufacturer)
|
|
{
|
|
$this->manufacturer = $manufacturer;
|
|
return $this;
|
|
}
|
|
|
|
public function getManufacturer()
|
|
{
|
|
return $this->manufacturer;
|
|
}
|
|
|
|
public function setModel($model)
|
|
{
|
|
$this->model = $model;
|
|
return $this;
|
|
}
|
|
|
|
public function getModel()
|
|
{
|
|
return $this->model;
|
|
}
|
|
|
|
public function setSize($size)
|
|
{
|
|
$this->size = $size;
|
|
return $this;
|
|
}
|
|
|
|
public function getSize()
|
|
{
|
|
return $this->size;
|
|
}
|
|
|
|
public function addVehicle(Vehicle $vehicle)
|
|
{
|
|
if (!isset($this->vehicles[$vehicle->getID()]))
|
|
$this->vehicles[$vehicle->getID()] = $vehicle;
|
|
return $this;
|
|
}
|
|
|
|
public function removeVehicle(Vehicle $vehicle)
|
|
{
|
|
if (isset($this->vehicles[$vehicle->getID()]))
|
|
unset($this->vehicles[$vehicle->getID()]);
|
|
return $this;
|
|
}
|
|
|
|
public function clearVehicles()
|
|
{
|
|
$this->vehicles->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getVehicles()
|
|
{
|
|
return $this->vehicles;
|
|
}
|
|
|
|
public function setProductCode($prod_code)
|
|
{
|
|
$this->prod_code = $prod_code;
|
|
return $this;
|
|
}
|
|
|
|
public function getProductCode()
|
|
{
|
|
return $this->prod_code;
|
|
}
|
|
|
|
public function setSAPCode($sap_code)
|
|
{
|
|
$this->sap_code = $sap_code;
|
|
return $this;
|
|
}
|
|
|
|
public function getSAPCode()
|
|
{
|
|
return $this->sap_code;
|
|
}
|
|
|
|
public function setWarrantyPrivate($warr_private)
|
|
{
|
|
$this->warr_private = $warr_private;
|
|
return $this;
|
|
}
|
|
|
|
public function getWarrantyPrivate()
|
|
{
|
|
return $this->warr_private;
|
|
}
|
|
|
|
public function setWarrantyCommercial($warr_commercial)
|
|
{
|
|
$this->warr_commercial = $warr_commercial;
|
|
return $this;
|
|
}
|
|
|
|
public function getWarrantyCommercial()
|
|
{
|
|
return $this->warr_commercial;
|
|
}
|
|
|
|
public function setWarrantyTnv($warr_tnv)
|
|
{
|
|
$this->warr_tnv = $warr_tnv;
|
|
return $this;
|
|
}
|
|
|
|
public function getWarrantyTnv()
|
|
{
|
|
return $this->warr_tnv;
|
|
}
|
|
|
|
public function setReserveCapacity($res_capacity)
|
|
{
|
|
$this->res_capacity = $res_capacity;
|
|
return $this;
|
|
}
|
|
|
|
public function getReserveCapacity()
|
|
{
|
|
return $this->res_capacity;
|
|
}
|
|
|
|
public function setLength($length)
|
|
{
|
|
$this->length = $length;
|
|
return $this;
|
|
}
|
|
|
|
public function getLength()
|
|
{
|
|
return $this->length;
|
|
}
|
|
|
|
public function setWidth($width)
|
|
{
|
|
$this->width = $width;
|
|
return $this;
|
|
}
|
|
|
|
public function getWidth()
|
|
{
|
|
return $this->width;
|
|
}
|
|
|
|
public function setHeight($height)
|
|
{
|
|
$this->height = $height;
|
|
return $this;
|
|
}
|
|
|
|
public function getHeight()
|
|
{
|
|
return $this->height;
|
|
}
|
|
|
|
public function setTotalHeight($total_height)
|
|
{
|
|
$this->total_height = $total_height;
|
|
return $this;
|
|
}
|
|
|
|
public function getTotalHeight()
|
|
{
|
|
return $this->total_height;
|
|
}
|
|
|
|
public function setSellingPrice($sell_price)
|
|
{
|
|
$this->sell_price = $sell_price;
|
|
return $this;
|
|
}
|
|
|
|
public function getSellingPrice()
|
|
{
|
|
return $this->sell_price;
|
|
}
|
|
|
|
public function addCustomerVehicle(CustomerVehicle $cust_vehicle)
|
|
{
|
|
$this->cust_vehicles->add($cust_vehicle);
|
|
return $this;
|
|
}
|
|
|
|
public function clearCustomerVehicles()
|
|
{
|
|
$this->cust_vehicles->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomerVehicles()
|
|
{
|
|
return $this->cust_vehicles;
|
|
}
|
|
|
|
public function setImageFile($image_file)
|
|
{
|
|
$this->image_file = $image_file;
|
|
return $this;
|
|
}
|
|
|
|
public function getImageFile()
|
|
{
|
|
return $this->image_file;
|
|
}
|
|
}
|