src/Entity/BrandingBanner.php line 197

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: yural
  5.  * Date: 21.12.2017
  6.  * Time: 23:36
  7.  */
  8. namespace Slivki\Entity;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use JsonSerializable;
  12. class BrandingBanner extends Entity implements JsonSerializable {
  13.     const FILE_PATH "/ximage/";
  14.     protected $bannerID;
  15.     protected $title;
  16.     protected $url;
  17.     protected $rightSideUrl;
  18.     protected $bigImage;
  19.     protected $middleImage;
  20.     protected $smallImage;
  21.     protected $active;
  22.     protected $test;
  23.     protected $activeSince;
  24.     protected $activeTill;
  25.     protected $mobileImage;
  26.     protected $mobileBanner;
  27.     protected $mobileDivider;
  28.     protected $categories;
  29.     protected $forCategories;
  30.     protected $passThrough;
  31.     protected ?Collection $cities;
  32.     protected $cityID;
  33.     public function __construct() {
  34.         $this->categories = new ArrayCollection();
  35.         $this->cities = new ArrayCollection();
  36.     }
  37.     public function getBannerID() {
  38.         return $this->bannerID;
  39.     }
  40.     public function setBannerID($bannerID) {
  41.         $this->bannerID $bannerID;
  42.     }
  43.     public function getTitle() {
  44.         return $this->title;
  45.     }
  46.     public function setTitle($title) {
  47.         $this->title $title;
  48.     }
  49.     public function getUrl() {
  50.         return $this->url;
  51.     }
  52.     public function setUrl($url) {
  53.         $this->url $url;
  54.     }
  55.     public function getRightSideUrl() {
  56.         return $this->rightSideUrl;
  57.     }
  58.     public function setRightSideUrl($rightSideUrl) {
  59.         $this->rightSideUrl $rightSideUrl;
  60.     }
  61.     public function getBigImage() {
  62.         return $this->bigImage;
  63.     }
  64.     public function setBigImage($bigImage) {
  65.         $this->bigImage $bigImage;
  66.     }
  67.     public function getMiddleImage() {
  68.         return $this->middleImage;
  69.     }
  70.     public function setMiddleImage($middleImage) {
  71.         $this->middleImage $middleImage;
  72.     }
  73.     public function getSmallImage() {
  74.         return $this->smallImage;
  75.     }
  76.     public function setSmallImage($smallImage) {
  77.         $this->smallImage $smallImage;
  78.     }
  79.     public function isActive() {
  80.         return $this->active;
  81.     }
  82.     public function setActive($active) {
  83.         $this->active $active;
  84.     }
  85.     public function isForCategories() {
  86.         return $this->forCategories;
  87.     }
  88.     public function setForCategories($forCategories) {
  89.         $this->forCategories $forCategories;
  90.     }
  91.     public function isPassThrough() {
  92.         return $this->passThrough;
  93.     }
  94.     public function setPassThrough($passThrough) {
  95.         $this->passThrough $passThrough;
  96.     }
  97.     public function isTest() {
  98.         return $this->test;
  99.     }
  100.     public function setTest($test) {
  101.         $this->test $test;
  102.     }
  103.     public function getActiveSince() {
  104.         return $this->activeSince;
  105.     }
  106.     public function setActiveSince($activeSince) {
  107.         $this->activeSince $activeSince;
  108.     }
  109.     public function getActiveTill() {
  110.         return $this->activeTill;
  111.     }
  112.     public function setActiveTill($activeTill) {
  113.         $this->activeTill $activeTill;
  114.     }
  115.     public function getMobileImage() {
  116.         return $this->mobileImage;
  117.     }
  118.     public function setMobileImage($mobileImage) {
  119.         $this->mobileImage $mobileImage;
  120.     }
  121.     public function getMobileBanner() {
  122.         return $this->mobileBanner;
  123.     }
  124.     public function setMobileBanner($mobileBanner) {
  125.         $this->mobileBanner $mobileBanner;
  126.     }
  127.     public function getMobileDivider() {
  128.         return $this->mobileDivider;
  129.     }
  130.     public function setMobileDivider($mobileDivider) {
  131.         $this->mobileDivider $mobileDivider;
  132.     }
  133.     public function getCategories() {
  134.         return $this->categories;
  135.     }
  136.     public function addCategory(Category $category) {
  137.         if (!$this->categories->contains($category)) {
  138.             $this->categories->add($category);
  139.         }
  140.     }
  141.     public function removeCategory($category) {
  142.         $this->categories->removeElement($category);
  143.     }
  144.     public function addCity(City $city): void
  145.     {
  146.         if (!$this->cities->contains($city)) {
  147.             $this->cities->add($city);
  148.         }
  149.     }
  150.     public function removeCities(): void
  151.     {
  152.         $this->cities->clear();
  153.     }
  154.     public function getCityIds(): array
  155.     {
  156.         return array_map(
  157.             static fn (City $city): int => $city->getID(),
  158.             $this->cities->getValues(),
  159.         );
  160.     }
  161.     public function jsonSerialize(): array
  162.     {
  163.         return [
  164.             'ID' => $this->ID,
  165.             'title' => $this->title,
  166.             'bannerID' => $this->bannerID,
  167.             'active' => $this->active,
  168.             'test' => $this->test,
  169.             'url' => $this->url,
  170.             'cityIds' => $this->getCityIds(),
  171.             'rightSideUrl' => $this->rightSideUrl,
  172.             'bigImage' => $this->bigImage,
  173.             'middleImage' => $this->middleImage,
  174.             'smallImage' => $this->smallImage,
  175.             'activeSince' => $this->activeSince,
  176.             'activeTill' => $this->activeTill,
  177.             'mobileImage' => $this->mobileImage,
  178.             'mobileBanner' => $this->mobileBanner,
  179.             'mobileDivider' => $this->mobileDivider,
  180.             'forCategories' => $this->forCategories,
  181.         ];
  182.     }
  183. }