<?php
namespace Submarine\PagesBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="page_b24warehouse")
*/
class PageB24Warehouse
{
const B24_ID_WH = [
2 => "Уручская",
3 => "Казинца",
5 => "Цнянка",
6 => "Промышленная",
7 => "Панченко",
];
/**
* @var integer
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private int $id;
/**
* Текущая страница
*
* @var Page
* @ORM\ManyToOne(targetEntity="Submarine\PagesBundle\Entity\Page", inversedBy="pageB24Warehouses")
* @ORM\JoinColumn(name="page_id", referencedColumnName="id")
*/
private Page $page;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private int $b24WHId;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private int $countInStock;
/**
* @param Page $page
*/
public function __construct(Page $page)
{
$this->page = $page;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return Page
*/
public function getPage(): Page
{
return $this->page;
}
/**
* @param Page $page
*/
public function setPage(Page $page): void
{
$this->page = $page;
}
/**
* @return int
*/
public function getB24WHId(): int
{
return $this->b24WHId;
}
/**
* @param int $b24WHId
*/
public function setB24WHId(int $b24WHId): void
{
$this->b24WHId = $b24WHId;
}
/**
* @return int
*/
public function getCountInStock(): int
{
return $this->countInStock;
}
/**
* @param int $countInStock
*/
public function setCountInStock(int $countInStock): void
{
$this->countInStock = $countInStock;
}
public function getViewProductPopupCount()
{
if($this->countInStock <= 5 ){
return $this->countInStock;
}
elseif ($this->countInStock <= 50){
return "> 5";
}
elseif ($this->countInStock <= 100){
return "> 50";
}
elseif ($this->countInStock <= 500){
return "> 100";
}
elseif ($this->countInStock <= 1000){
return "> 500";
}
return "> 1000";
}
}