modules/QSL/Banner/src/Model/Content.php line 18

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace QSL\Banner\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * Banner image
  10.  *
  11.  * @ORM\Entity
  12.  * @ORM\Table  (name="banner_contents")
  13.  */
  14. class Content extends \XLite\Model\Base\I18n
  15. {
  16.     public const CONTENT_TYPE  'C';
  17.     /**
  18.      *  Unique id
  19.      *
  20.      * @var   integer
  21.      *
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue (strategy="AUTO")
  24.      * @ORM\Column         (type="integer", options={"unsigned": true})
  25.      */
  26.     protected $content_id;
  27.     /**
  28.      * Position
  29.      *
  30.      * @var   integer
  31.      *
  32.      * @ORM\Column (type="integer")
  33.      */
  34.     protected $position 5;
  35.     /**
  36.      * Relation to a product entity
  37.      *
  38.      * @var  \Doctrine\Common\Collections\ArrayCollection
  39.      *
  40.      * @ORM\ManyToOne  (targetEntity="QSL\Banner\Model\Banner", inversedBy="contents")
  41.      * @ORM\JoinColumn (name="banner_id", referencedColumnName="id")
  42.      */
  43.     protected $banner;
  44.     /**
  45.      * @var \Doctrine\Common\Collections\Collection
  46.      *
  47.      * @ORM\OneToMany (targetEntity="QSL\Banner\Model\ContentTranslation", mappedBy="owner", cascade={"all"})
  48.      */
  49.     protected $translations;
  50.      /**
  51.      * Get event cell base information
  52.      *
  53.      * @return string
  54.      */
  55.     public function getEventCell()
  56.     {
  57.         return self::CONTENT_TYPE;
  58.     }
  59.     /**
  60.      * Set image
  61.      *
  62.      * @param \QSL\Banner\Model\Banner $banner
  63.      * @return Content
  64.      */
  65.     public function setBanner(\QSL\Banner\Model\Banner $banner)
  66.     {
  67.         $this->banner $banner;
  68.         return $this;
  69.     }
  70.     /**
  71.      * Get image
  72.      *
  73.      * @return \QSL\Banner\Model\Banner
  74.      */
  75.     public function getBanner()
  76.     {
  77.         return $this->banner;
  78.     }
  79.     /**
  80.      * Set position
  81.      *
  82.      * @param integer $position
  83.      * @return Content
  84.      */
  85.     public function setPosition($position)
  86.     {
  87.         $this->position $position;
  88.         return $this;
  89.     }
  90.     /**
  91.      * Get enabled
  92.      *
  93.      * @return boolean
  94.      */
  95.     public function getPosition()
  96.     {
  97.         return $this->position;
  98.     }
  99.     /**
  100.      * Returns the slide HTML content.
  101.      *
  102.      * @return string
  103.      */
  104.     public function getContent()
  105.     {
  106.         return $this->getSoftTranslation()?->getContent() ?? '';
  107.     }
  108. }