classes/XLite/Model/ProductTranslation.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 XLite\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * Product multilingual data
  10.  *
  11.  * @ORM\Entity
  12.  *
  13.  * @ORM\Table (name="product_translations",
  14.  *         indexes={
  15.  *              @ORM\Index (name="ci", columns={"code","id"}),
  16.  *              @ORM\Index (name="id", columns={"id"}),
  17.  *              @ORM\Index (name="name", columns={"name"})
  18.  *         }
  19.  * )
  20.  */
  21. class ProductTranslation extends \XLite\Model\Base\Translation
  22. {
  23.     /**
  24.      * Product name
  25.      *
  26.      * @var string
  27.      *
  28.      * @ORM\Column (type="string", length=255)
  29.      */
  30.     protected $name;
  31.     /**
  32.      * Product description
  33.      *
  34.      * @var string
  35.      *
  36.      * @ORM\Column (type="text")
  37.      */
  38.     protected $description '';
  39.     /**
  40.      * Product brief description
  41.      *
  42.      * @var string
  43.      *
  44.      * @ORM\Column (type="text")
  45.      */
  46.     protected $briefDescription '';
  47.     /**
  48.      * Meta tags
  49.      *
  50.      * @var string
  51.      *
  52.      * @ORM\Column (type="string", length=255)
  53.      */
  54.     protected $metaTags '';
  55.     /**
  56.      * Product meta description
  57.      *
  58.      * @var string
  59.      *
  60.      * @ORM\Column (type="text")
  61.      */
  62.     protected $metaDesc '';
  63.     /**
  64.      * Meta title
  65.      *
  66.      * @var string
  67.      *
  68.      * @ORM\Column (type="string", length=255)
  69.      */
  70.     protected $metaTitle '';
  71.     /**
  72.      * @var \XLite\Model\Product
  73.      *
  74.      * @ORM\ManyToOne (targetEntity="XLite\Model\Product", inversedBy="translations")
  75.      * @ORM\JoinColumn (name="id", referencedColumnName="product_id", onDelete="CASCADE")
  76.      */
  77.     protected $owner;
  78.     /**
  79.      * Set name
  80.      *
  81.      * @param string $name
  82.      * @return ProductTranslation
  83.      */
  84.     public function setName($name)
  85.     {
  86.         $this->name mb_substr((string) $name0$this->getFieldLength('name'));
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get name
  91.      *
  92.      * @return string
  93.      */
  94.     public function getName()
  95.     {
  96.         return $this->name;
  97.     }
  98.     /**
  99.      * Set description
  100.      *
  101.      * @param string $description
  102.      * @return ProductTranslation
  103.      */
  104.     public function setDescription($description)
  105.     {
  106.         $this->description $description;
  107.         return $this;
  108.     }
  109.     /**
  110.      * Get description
  111.      *
  112.      * @return string
  113.      */
  114.     public function getDescription()
  115.     {
  116.         return $this->description;
  117.     }
  118.     /**
  119.      * Set briefDescription
  120.      *
  121.      * @param string $briefDescription
  122.      * @return ProductTranslation
  123.      */
  124.     public function setBriefDescription($briefDescription)
  125.     {
  126.         $this->briefDescription $briefDescription;
  127.         return $this;
  128.     }
  129.     /**
  130.      * Get briefDescription
  131.      *
  132.      * @return string
  133.      */
  134.     public function getBriefDescription()
  135.     {
  136.         return $this->briefDescription;
  137.     }
  138.     /**
  139.      * Set metaTags
  140.      *
  141.      * @param string $metaTags
  142.      * @return ProductTranslation
  143.      */
  144.     public function setMetaTags($metaTags)
  145.     {
  146.         $this->metaTags mb_substr($metaTags0$this->getFieldLength('metaTags'));
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get metaTags
  151.      *
  152.      * @return string
  153.      */
  154.     public function getMetaTags()
  155.     {
  156.         return $this->metaTags;
  157.     }
  158.     /**
  159.      * Set metaDesc
  160.      *
  161.      * @param string $metaDesc
  162.      * @return ProductTranslation
  163.      */
  164.     public function setMetaDesc($metaDesc)
  165.     {
  166.         $this->metaDesc $metaDesc;
  167.         return $this;
  168.     }
  169.     /**
  170.      * Get metaDesc
  171.      *
  172.      * @return string
  173.      */
  174.     public function getMetaDesc()
  175.     {
  176.         return $this->metaDesc;
  177.     }
  178.     /**
  179.      * Set metaTitle
  180.      *
  181.      * @param string $metaTitle
  182.      * @return ProductTranslation
  183.      */
  184.     public function setMetaTitle($metaTitle)
  185.     {
  186.         $this->metaTitle mb_substr($metaTitle0$this->getFieldLength('metaTitle'));
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get metaTitle
  191.      *
  192.      * @return string
  193.      */
  194.     public function getMetaTitle()
  195.     {
  196.         return $this->metaTitle;
  197.     }
  198.     /**
  199.      * Get label_id
  200.      *
  201.      * @return integer
  202.      */
  203.     public function getLabelId()
  204.     {
  205.         return $this->label_id;
  206.     }
  207.     /**
  208.      * Set code
  209.      *
  210.      * @param string $code
  211.      * @return ProductTranslation
  212.      */
  213.     public function setCode($code)
  214.     {
  215.         $this->code $code;
  216.         return $this;
  217.     }
  218.     /**
  219.      * Get code
  220.      *
  221.      * @return string
  222.      */
  223.     public function getCode()
  224.     {
  225.         return $this->code;
  226.     }
  227.     protected function getFieldLength($name)
  228.     {
  229.         return $this->getRepository()->getFieldInfo($name'length');
  230.     }
  231. }