var/classes/DataObject/Category.php line 26

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  * Category for News and Events
  6.  *
  7.  * Fields Summary:
  8.  * - localizedfields [localizedfields]
  9.  * -- name [input]
  10.  * -- marked [checkbox]
  11.  */
  12. namespace Pimcore\Model\DataObject;
  13. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  14. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  15. /**
  16. * @method static \Pimcore\Model\DataObject\Category\Listing getList(array $config = [])
  17. * @method static \Pimcore\Model\DataObject\Category\Listing|\Pimcore\Model\DataObject\Category|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  18. * @method static \Pimcore\Model\DataObject\Category\Listing|\Pimcore\Model\DataObject\Category|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\Category\Listing|\Pimcore\Model\DataObject\Category|null getByMarked($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  20. */
  21. class Category extends Concrete
  22. {
  23. protected $o_classId "7";
  24. protected $o_className "Category";
  25. protected $localizedfields;
  26. /**
  27. * @param array $values
  28. * @return \Pimcore\Model\DataObject\Category
  29. */
  30. public static function create($values = array()) {
  31.     $object = new static();
  32.     $object->setValues($values);
  33.     return $object;
  34. }
  35. /**
  36. * Get localizedfields - 
  37. * @return \Pimcore\Model\DataObject\Localizedfield|null
  38. */
  39. public function getLocalizedfields()
  40. {
  41.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  42.         $preValue $this->preGetValue("localizedfields");
  43.         if ($preValue !== null) {
  44.             return $preValue;
  45.         }
  46.     }
  47.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  48.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  49.         return $data->getPlain();
  50.     }
  51.     return $data;
  52. }
  53. /**
  54. * Get name - Name
  55. * @return string|null
  56. */
  57. public function getName($language null)
  58. {
  59.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  60.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  61.         $preValue $this->preGetValue("name");
  62.         if ($preValue !== null) {
  63.             return $preValue;
  64.         }
  65.     }
  66.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  67.         return $data->getPlain();
  68.     }
  69.     return $data;
  70. }
  71. /**
  72. * Get marked - Mark category
  73. * @return bool|null
  74. */
  75. public function getMarked($language null)
  76. {
  77.     $data $this->getLocalizedfields()->getLocalizedValue("marked"$language);
  78.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  79.         $preValue $this->preGetValue("marked");
  80.         if ($preValue !== null) {
  81.             return $preValue;
  82.         }
  83.     }
  84.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  85.         return $data->getPlain();
  86.     }
  87.     return $data;
  88. }
  89. /**
  90. * Set localizedfields - 
  91. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  92. * @return \Pimcore\Model\DataObject\Category
  93. */
  94. public function setLocalizedfields($localizedfields)
  95. {
  96.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  97.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  98.     $currentData $this->getLocalizedfields();
  99.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  100.     $this->markFieldDirty("localizedfields"true);
  101.     $this->localizedfields $localizedfields;
  102.     return $this;
  103. }
  104. /**
  105. * Set name - Name
  106. * @param string|null $name
  107. * @return \Pimcore\Model\DataObject\Category
  108. */
  109. public function setName ($name$language null)
  110. {
  111.     $isEqual false;
  112.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  113.     return $this;
  114. }
  115. /**
  116. * Set marked - Mark category
  117. * @param bool|null $marked
  118. * @return \Pimcore\Model\DataObject\Category
  119. */
  120. public function setMarked ($marked$language null)
  121. {
  122.     $isEqual false;
  123.     $this->getLocalizedfields()->setLocalizedValue("marked"$marked$language, !$isEqual);
  124.     return $this;
  125. }
  126. }