src/Submarine/PagesBundle/Entity/PageB24Warehouse.php line 11

Open in your IDE?
  1. <?php
  2. namespace Submarine\PagesBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity
  6.  * @ORM\Table(name="page_b24warehouse")
  7.  */
  8. class PageB24Warehouse
  9. {
  10.     const B24_ID_WH = [
  11.         => "Уручская",
  12.         => "Казинца",
  13.         => "Цнянка",
  14.         => "Промышленная",
  15.         => "Панченко",
  16.     ];
  17.     /**
  18.      * @var integer
  19.      *
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private int $id;
  25.     /**
  26.      * Текущая страница
  27.      *
  28.      * @var Page
  29.      * @ORM\ManyToOne(targetEntity="Submarine\PagesBundle\Entity\Page", inversedBy="pageB24Warehouses")
  30.      * @ORM\JoinColumn(name="page_id", referencedColumnName="id")
  31.      */
  32.     private Page $page;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=false)
  35.      */
  36.     private int $b24WHId;
  37.     /**
  38.      * @ORM\Column(type="integer", nullable=false)
  39.      */
  40.     private int $countInStock;
  41.     /**
  42.      * @param Page $page
  43.      */
  44.     public function __construct(Page $page)
  45.     {
  46.         $this->page $page;
  47.     }
  48.     /**
  49.      * @return int
  50.      */
  51.     public function getId(): int
  52.     {
  53.         return $this->id;
  54.     }
  55.     /**
  56.      * @param int $id
  57.      */
  58.     public function setId(int $id): void
  59.     {
  60.         $this->id $id;
  61.     }
  62.     /**
  63.      * @return Page
  64.      */
  65.     public function getPage(): Page
  66.     {
  67.         return $this->page;
  68.     }
  69.     /**
  70.      * @param Page $page
  71.      */
  72.     public function setPage(Page $page): void
  73.     {
  74.         $this->page $page;
  75.     }
  76.     /**
  77.      * @return int
  78.      */
  79.     public function getB24WHId(): int
  80.     {
  81.         return $this->b24WHId;
  82.     }
  83.     /**
  84.      * @param int $b24WHId
  85.      */
  86.     public function setB24WHId(int $b24WHId): void
  87.     {
  88.         $this->b24WHId $b24WHId;
  89.     }
  90.     /**
  91.      * @return int
  92.      */
  93.     public function getCountInStock(): int
  94.     {
  95.         return $this->countInStock;
  96.     }
  97.     /**
  98.      * @param int $countInStock
  99.      */
  100.     public function setCountInStock(int $countInStock): void
  101.     {
  102.         $this->countInStock $countInStock;
  103.     }
  104.     public function getViewProductPopupCount()
  105.     {
  106.         if($this->countInStock <= ){
  107.             return $this->countInStock;
  108.         }
  109.         elseif ($this->countInStock <= 50){
  110.             return "> 5";
  111.         }
  112.         elseif ($this->countInStock  <= 100){
  113.             return "> 50";
  114.         }
  115.         elseif ($this->countInStock  <= 500){
  116.             return "> 100";
  117.         }
  118.         elseif ($this->countInStock  <= 1000){
  119.             return "> 500";
  120.         }
  121.         return "> 1000";
  122.     }
  123. }