88 lines
1.7 KiB
PHP
88 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="price_tier")
|
|
*/
|
|
|
|
class PriceTier
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// name of price tier
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
*/
|
|
protected $name;
|
|
|
|
// supported areas under price tier
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="SupportedArea", mappedBy="price_tier");
|
|
*/
|
|
protected $supported_areas;
|
|
|
|
// items under a price tier
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="ItemPrice", mappedBy="price_tier")
|
|
*/
|
|
protected $item_prices;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->supported_areas = new ArrayCollection();
|
|
$this->items = new ArrayCollection();
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function getSupportedAreaObjects()
|
|
{
|
|
return $this->supported_areas;
|
|
}
|
|
|
|
public function getSupportedAreas()
|
|
{
|
|
$str_supported_areas = [];
|
|
foreach ($this->supported_areas as $supported_area)
|
|
$str_supported_areas[] = $supported_area->getID();
|
|
|
|
return $str_supported_areas;
|
|
}
|
|
|
|
public function clearSupportedAreas()
|
|
{
|
|
$this->supported_areas->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getItemPrices()
|
|
{
|
|
return $this->item_prices;
|
|
}
|
|
|
|
}
|