modules/QSL/ColorSwatches/src/Model/Swatch.php line 16

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\ColorSwatches\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity
  10.  * @ORM\Table (name="qsl_color_swatches")
  11.  */
  12. class Swatch extends \XLite\Model\Base\I18n
  13. {
  14.     /**
  15.      * ID
  16.      *
  17.      * @var integer
  18.      *
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue (strategy="AUTO")
  21.      * @ORM\Column         (type="integer", options={ "unsigned": true })
  22.      */
  23.     protected $id;
  24.     /**
  25.      * Color
  26.      *
  27.      * @var string
  28.      *
  29.      * @ORM\Column (type="string", length=6, nullable=true)
  30.      */
  31.     protected $color;
  32.     /**
  33.      * Position
  34.      *
  35.      * @var integer
  36.      *
  37.      * @ORM\Column (type="integer")
  38.      */
  39.     protected $position 0;
  40.     /**
  41.      * Image
  42.      *
  43.      * @var \QSL\ColorSwatches\Model\Image\Swatch
  44.      *
  45.      * @ORM\OneToOne (targetEntity="QSL\ColorSwatches\Model\Image\Swatch", mappedBy="swatch", cascade={"all"})
  46.      */
  47.     protected $image;
  48.     /**
  49.      * Attribute values
  50.      *
  51.      * @var \Doctrine\Common\Collections\Collection
  52.      *
  53.      * @ORM\OneToMany (targetEntity="XLite\Model\AttributeValue\AttributeValueSelect", mappedBy="swatch", cascade={"all"})
  54.      */
  55.     protected $attributes;
  56.     /**
  57.      * Default flag
  58.      *
  59.      * @var boolean
  60.      *
  61.      * @ORM\Column (type="boolean")
  62.      */
  63.     protected $defaultValue false;
  64.     /**
  65.      * @var \Doctrine\Common\Collections\Collection
  66.      *
  67.      * @ORM\OneToMany (targetEntity="QSL\ColorSwatches\Model\SwatchTranslation", mappedBy="owner", cascade={"all"})
  68.      */
  69.     protected $translations;
  70.     /**
  71.      * @inheritdoc
  72.      */
  73.     public function __construct(array $data = [])
  74.     {
  75.         $this->attributes = new \Doctrine\Common\Collections\ArrayCollection();
  76.         parent::__construct($data);
  77.     }
  78.     /**
  79.      * Get id
  80.      *
  81.      * @return integer
  82.      */
  83.     public function getId()
  84.     {
  85.         return $this->id;
  86.     }
  87.     /**
  88.      * Set color
  89.      *
  90.      * @param string $color
  91.      * @return Swatch
  92.      */
  93.     public function setColor($color)
  94.     {
  95.         $this->color $color;
  96.         return $this;
  97.     }
  98.     /**
  99.      * Get color
  100.      *
  101.      * @return string
  102.      */
  103.     public function getColor()
  104.     {
  105.         return $this->color;
  106.     }
  107.     /**
  108.      * Set position
  109.      *
  110.      * @param integer $position
  111.      * @return Swatch
  112.      */
  113.     public function setPosition($position)
  114.     {
  115.         $this->position $position;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Get position
  120.      *
  121.      * @return integer
  122.      */
  123.     public function getPosition()
  124.     {
  125.         return $this->position;
  126.     }
  127.     /**
  128.      * Set image
  129.      *
  130.      * @param \QSL\ColorSwatches\Model\Image\Swatch $image
  131.      * @return Swatch
  132.      */
  133.     public function setImage(\QSL\ColorSwatches\Model\Image\Swatch $image null)
  134.     {
  135.         $this->image $image;
  136.         return $this;
  137.     }
  138.     /**
  139.      * Get image
  140.      *
  141.      * @return \QSL\ColorSwatches\Model\Image\Swatch
  142.      */
  143.     public function getImage()
  144.     {
  145.         return $this->image;
  146.     }
  147.     /**
  148.      * Add attributes
  149.      *
  150.      * @param \XLite\Model\AttributeValue\AttributeValueSelect $attributes
  151.      * @return Swatch
  152.      */
  153.     public function addAttributes(\XLite\Model\AttributeValue\AttributeValueSelect $attributes)
  154.     {
  155.         $this->attributes[] = $attributes;
  156.         return $this;
  157.     }
  158.     /**
  159.      * Get attributes
  160.      *
  161.      * @return \Doctrine\Common\Collections\Collection
  162.      */
  163.     public function getAttributes()
  164.     {
  165.         return $this->attributes;
  166.     }
  167.     /**
  168.      * @param boolean $defaultValue
  169.      * @return $this
  170.      */
  171.     public function setDefaultValue($defaultValue)
  172.     {
  173.         $this->defaultValue $defaultValue;
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return boolean
  178.      */
  179.     public function getDefaultValue()
  180.     {
  181.         return $this->defaultValue;
  182.     }
  183.     /**
  184.      * @return boolean
  185.      */
  186.     public function isDefaultValue()
  187.     {
  188.         return $this->getDefaultValue();
  189.     }
  190. }