modules/QSL/ProductStickers/src/Model/ProductSticker.php line 74

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\ProductStickers\Model;
  7. use ApiPlatform\Core\Annotation as ApiPlatform;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use QSL\ProductStickers\API\Endpoint\ProductSticker\DTO\ProductStickerInput as Input;
  10. use QSL\ProductStickers\API\Endpoint\ProductSticker\DTO\ProductStickerOutput as Output;
  11. /**
  12.  * @ORM\Entity
  13.  * @ORM\Table (name="product_stickers")
  14.  * @ApiPlatform\ApiResource(
  15.  *     shortName="Product Sticker",
  16.  *     input=Input::class,
  17.  *     output=Output::class,
  18.  *     itemOperations={
  19.  *          "get"={
  20.  *              "method"="GET",
  21.  *              "path"="/product_stickers/{sticker_id}.{_format}",
  22.  *              "identifiers"={"sticker_id"},
  23.  *              "requirements"={"sticker_id"="\d+"},
  24.  *              "openapi_context"={
  25.  *                  "parameters"={
  26.  *                      {"name"="sticker_id", "in"="path", "required"=true, "schema"={"type"="integer"}}
  27.  *                  }
  28.  *              }
  29.  *          },
  30.  *          "put"={
  31.  *              "method"="PUT",
  32.  *              "path"="/product_stickers/{sticker_id}.{_format}",
  33.  *              "identifiers"={"sticker_id"},
  34.  *              "requirements"={"sticker_id"="\d+"},
  35.  *              "openapi_context"={
  36.  *                  "parameters"={
  37.  *                      {"name"="sticker_id", "in"="path", "required"=true, "schema"={"type"="integer"}}
  38.  *                  }
  39.  *              }
  40.  *          },
  41.  *          "delete"={
  42.  *              "method"="DELETE",
  43.  *              "path"="/product_stickers/{sticker_id}.{_format}",
  44.  *              "identifiers"={"sticker_id"},
  45.  *              "requirements"={"sticker_id"="\d+"},
  46.  *              "openapi_context"={
  47.  *                  "parameters"={
  48.  *                      {"name"="sticker_id", "in"="path", "required"=true, "schema"={"type"="integer"}}
  49.  *                  }
  50.  *              }
  51.  *          }
  52.  *     },
  53.  *     collectionOperations={
  54.  *          "get"={
  55.  *              "method"="GET",
  56.  *              "path"="/product_stickers.{_format}",
  57.  *              "identifiers"={},
  58.  *              "requirements"={}
  59.  *          },
  60.  *          "post"={
  61.  *              "method"="POST",
  62.  *              "path"="/product_stickers.{_format}",
  63.  *              "controller"="xcart.api.qsl.product_stickers.product_sticker.controller",
  64.  *              "identifiers"={},
  65.  *              "requirements"={}
  66.  *          }
  67.  *     }
  68.  * )
  69.  */
  70. class ProductSticker extends \XLite\Model\Base\I18n
  71. {
  72.      /**
  73.      * Unique ID
  74.      *
  75.      * @var   integer
  76.      *
  77.      * @ORM\Id
  78.      * @ORM\GeneratedValue (strategy="AUTO")
  79.      * @ORM\Column         (type="integer", options={"unsigned": true})
  80.      */
  81.     protected $sticker_id;
  82.     /**
  83.      * Position
  84.      *
  85.      * @var   integer
  86.      *
  87.      * @ORM\Column (type="integer")
  88.      */
  89.     protected $position 0;
  90.     /**
  91.     * @ORM\Column (type="boolean")
  92.     */
  93.     protected $enabled true;
  94.     /**
  95.      * Name color
  96.      *
  97.      * @var string
  98.      *
  99.      * @ORM\Column (type="string")
  100.      */
  101.     protected $text_color;
  102.     /**
  103.      * Name color
  104.      *
  105.      * @var string
  106.      *
  107.      * @ORM\Column (type="string")
  108.      */
  109.     protected $bg_color;
  110.     /**
  111.      * Products
  112.      *
  113.      * @var \Doctrine\Common\Collections\ArrayCollection
  114.      *
  115.      * @ORM\ManyToMany (targetEntity="XLite\Model\Product", mappedBy="product_stickers", fetch="LAZY")
  116.      */
  117.     protected $products;
  118.     /**
  119.      * Categories
  120.      *
  121.      * @var \Doctrine\Common\Collections\ArrayCollection
  122.      *
  123.      * @ORM\ManyToMany (targetEntity="XLite\Model\Category", mappedBy="category_stickers", fetch="LAZY")
  124.      */
  125.     protected $categories;
  126.     /**
  127.      * @var boolean
  128.      *
  129.      * @ORM\Column(type="boolean", options={"default":false})
  130.      */
  131.     protected $isLabel false;
  132.     /**
  133.      * @var \Doctrine\Common\Collections\Collection
  134.      *
  135.      * @ORM\OneToMany (targetEntity="QSL\ProductStickers\Model\ProductStickerTranslation", mappedBy="owner", cascade={"all"})
  136.      */
  137.     protected $translations;
  138.     /**
  139.      * @return string
  140.      */
  141.     public function getTextColor()
  142.     {
  143.         return $this->text_color;
  144.     }
  145.     /**
  146.      * @param string $text_color
  147.      */
  148.     public function setTextColor($text_color)
  149.     {
  150.         $this->text_color $text_color;
  151.     }
  152.     /**
  153.      * @return string
  154.      */
  155.     public function getBgColor()
  156.     {
  157.         return $this->bg_color;
  158.     }
  159.     /**
  160.      * @param string $bg_color
  161.      */
  162.     public function setBgColor($bg_color)
  163.     {
  164.         $this->bg_color $bg_color;
  165.     }
  166.     /**
  167.      * Set enabled
  168.      *
  169.      * @param boolean $enabled
  170.      * @return ProductSticker
  171.      */
  172.     public function setEnabled($enabled)
  173.     {
  174.         $this->enabled $enabled;
  175.         return $this;
  176.     }
  177.     /**
  178.      * Get enabled
  179.      *
  180.      * @return boolean
  181.      */
  182.     public function getEnabled()
  183.     {
  184.         return $this->enabled;
  185.     }
  186.     /**
  187.      * Set enabled
  188.      *
  189.      * @return integer
  190.      */
  191.     public function setPosition($position)
  192.     {
  193.         $this->position $position;
  194.         return $this;
  195.     }
  196.     /**
  197.      * Get enabled
  198.      *
  199.      * @return boolean
  200.      */
  201.     public function getPosition()
  202.     {
  203.         return $this->position;
  204.     }
  205.     /**
  206.      * Add products
  207.      *
  208.      * @param \XLite\Model\Product $products
  209.      * @return ProductSticker
  210.      */
  211.     public function addProducts(\XLite\Model\Product $products)
  212.     {
  213.         $this->products[] = $products;
  214.         return $this;
  215.     }
  216.     /**
  217.      * Get products
  218.      *
  219.      * @return \Doctrine\Common\Collections\Collection
  220.      */
  221.     public function getProducts()
  222.     {
  223.         return $this->products;
  224.     }
  225.     /**
  226.      * Get sticker_id
  227.      *
  228.      * @return integer
  229.      */
  230.     public function getProductStickerId()
  231.     {
  232.         return $this->sticker_id;
  233.     }
  234.     /**
  235.      * Set sticker_id
  236.      *
  237.      * @return $this
  238.      */
  239.     public function setProductStickerId($sticker_id)
  240.     {
  241.         $this->sticker_id $sticker_id;
  242.         return $this;
  243.     }
  244.     /**
  245.      * @param boolean $isLabel
  246.      * @return $this
  247.      */
  248.     public function setIsLabel($isLabel)
  249.     {
  250.         $this->isLabel $isLabel;
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return bool
  255.      */
  256.     public function getIsLabel()
  257.     {
  258.         return $this->isLabel;
  259.     }
  260.     /**
  261.      * @return bool
  262.      */
  263.     public function isLabel()
  264.     {
  265.         return $this->isLabel;
  266.     }
  267. }