169 lines
3.3 KiB
PHP
169 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="battery_size")
|
|
*/
|
|
class BatterySize
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// name
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $name;
|
|
|
|
// battery
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Battery", mappedBy="size")
|
|
*/
|
|
protected $batteries;
|
|
|
|
// motolite trade-in price
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2)
|
|
*/
|
|
protected $tip_motolite;
|
|
|
|
// premium trade-in price
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2)
|
|
*/
|
|
protected $tip_premium;
|
|
|
|
// other trade-in price
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2)
|
|
*/
|
|
protected $tip_other;
|
|
|
|
// lazada trade-in price
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2)
|
|
*/
|
|
protected $tip_lazada;
|
|
|
|
// subscription msrp
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=7, scale=2, nullable=true)
|
|
*/
|
|
protected $sub_msrp;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->batteries = new ArrayCollection();
|
|
$this->tip_motolite = 0;
|
|
$this->tip_premium = 0;
|
|
$this->tip_other = 0;
|
|
$this->tip_lazada = 0;
|
|
$this->sub_msrp = 0;
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function addBattery(Battery $battery)
|
|
{
|
|
$this->batteries->add($battery);
|
|
return $this;
|
|
}
|
|
|
|
public function clearBatteries()
|
|
{
|
|
$this->batteries->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getBatteries()
|
|
{
|
|
// TODO: fix this to be a proper getter function
|
|
// has to return set of strings because symfony is trying to move away from role objects
|
|
$str_batteries = [];
|
|
foreach ($this->batteries as $battery)
|
|
$str_batteries[] = $this->getProductCode();
|
|
|
|
return $str_batteries;
|
|
}
|
|
|
|
public function setTIPriceMotolite($price)
|
|
{
|
|
$this->tip_motolite = $price;
|
|
return $this;
|
|
}
|
|
|
|
public function getTIPriceMotolite()
|
|
{
|
|
return $this->tip_motolite;
|
|
}
|
|
|
|
public function setTIPricePremium($price)
|
|
{
|
|
$this->tip_premium = $price;
|
|
return $this;
|
|
}
|
|
|
|
public function getTIPricePremium()
|
|
{
|
|
return $this->tip_premium;
|
|
}
|
|
|
|
public function setTIPriceOther($price)
|
|
{
|
|
$this->tip_other = $price;
|
|
return $this;
|
|
}
|
|
|
|
public function getTIPriceOther()
|
|
{
|
|
return $this->tip_other;
|
|
}
|
|
|
|
public function setTIPriceLazada($price)
|
|
{
|
|
$this->tip_lazada = $price;
|
|
return $this;
|
|
}
|
|
|
|
public function getTIPriceLazada()
|
|
{
|
|
return $this->tip_lazada;
|
|
}
|
|
|
|
public function setSubMSRP($sub_msrp)
|
|
{
|
|
$this->sub_msrp = $sub_msrp;
|
|
return $this;
|
|
}
|
|
|
|
public function getSubMSRP()
|
|
{
|
|
return $this->sub_msrp;
|
|
}
|
|
}
|