var/classes/DataObject/MediaCategory.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - localizedfields [localizedfields]
  8.  * -- name [input]
  9.  * - sorting [numeric]
  10.  * - hidden [checkbox]
  11.  * - legacyId [input]
  12.  */
  13. namespace Pimcore\Model\DataObject;
  14. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  15. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  16. /**
  17. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing getList(array $config = [])
  18. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  20. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getBySorting($value, $limit = 0, $offset = 0, $objectTypes = null)
  21. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByHidden($value, $limit = 0, $offset = 0, $objectTypes = null)
  22. * @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByLegacyId($value, $limit = 0, $offset = 0, $objectTypes = null)
  23. */
  24. class MediaCategory extends Concrete
  25. {
  26. protected $o_classId "MediaCategory";
  27. protected $o_className "MediaCategory";
  28. protected $localizedfields;
  29. protected $sorting;
  30. protected $hidden;
  31. protected $legacyId;
  32. /**
  33. * @param array $values
  34. * @return \Pimcore\Model\DataObject\MediaCategory
  35. */
  36. public static function create($values = array()) {
  37.     $object = new static();
  38.     $object->setValues($values);
  39.     return $object;
  40. }
  41. /**
  42. * Get localizedfields - 
  43. * @return \Pimcore\Model\DataObject\Localizedfield|null
  44. */
  45. public function getLocalizedfields()
  46. {
  47.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  48.         $preValue $this->preGetValue("localizedfields");
  49.         if ($preValue !== null) {
  50.             return $preValue;
  51.         }
  52.     }
  53.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  54.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  55.         return $data->getPlain();
  56.     }
  57.     return $data;
  58. }
  59. /**
  60. * Get name - Name
  61. * @return string|null
  62. */
  63. public function getName($language null)
  64. {
  65.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  66.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  67.         $preValue $this->preGetValue("name");
  68.         if ($preValue !== null) {
  69.             return $preValue;
  70.         }
  71.     }
  72.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  73.         return $data->getPlain();
  74.     }
  75.     return $data;
  76. }
  77. /**
  78. * Set localizedfields - 
  79. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  80. * @return \Pimcore\Model\DataObject\MediaCategory
  81. */
  82. public function setLocalizedfields($localizedfields)
  83. {
  84.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  85.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  86.     $currentData $this->getLocalizedfields();
  87.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  88.     $this->markFieldDirty("localizedfields"true);
  89.     $this->localizedfields $localizedfields;
  90.     return $this;
  91. }
  92. /**
  93. * Set name - Name
  94. * @param string|null $name
  95. * @return \Pimcore\Model\DataObject\MediaCategory
  96. */
  97. public function setName ($name$language null)
  98. {
  99.     $isEqual false;
  100.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  101.     return $this;
  102. }
  103. /**
  104. * Get sorting - Sortierung
  105. * @return float|null
  106. */
  107. public function getSorting()
  108. {
  109.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  110.         $preValue $this->preGetValue("sorting");
  111.         if ($preValue !== null) {
  112.             return $preValue;
  113.         }
  114.     }
  115.     $data $this->sorting;
  116.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  117.         return $data->getPlain();
  118.     }
  119.     return $data;
  120. }
  121. /**
  122. * Set sorting - Sortierung
  123. * @param float|null $sorting
  124. * @return \Pimcore\Model\DataObject\MediaCategory
  125. */
  126. public function setSorting($sorting)
  127. {
  128.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Numeric $fd */
  129.     $fd $this->getClass()->getFieldDefinition("sorting");
  130.     $this->sorting $fd->preSetData($this$sorting);
  131.     return $this;
  132. }
  133. /**
  134. * Get hidden - versteckt
  135. * @return bool|null
  136. */
  137. public function getHidden()
  138. {
  139.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  140.         $preValue $this->preGetValue("hidden");
  141.         if ($preValue !== null) {
  142.             return $preValue;
  143.         }
  144.     }
  145.     $data $this->hidden;
  146.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  147.         return $data->getPlain();
  148.     }
  149.     return $data;
  150. }
  151. /**
  152. * Set hidden - versteckt
  153. * @param bool|null $hidden
  154. * @return \Pimcore\Model\DataObject\MediaCategory
  155. */
  156. public function setHidden($hidden)
  157. {
  158.     $this->hidden $hidden;
  159.     return $this;
  160. }
  161. /**
  162. * Get legacyId - Legacy Id
  163. * @return string|null
  164. */
  165. public function getLegacyId()
  166. {
  167.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  168.         $preValue $this->preGetValue("legacyId");
  169.         if ($preValue !== null) {
  170.             return $preValue;
  171.         }
  172.     }
  173.     $data $this->legacyId;
  174.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  175.         return $data->getPlain();
  176.     }
  177.     return $data;
  178. }
  179. /**
  180. * Set legacyId - Legacy Id
  181. * @param string|null $legacyId
  182. * @return \Pimcore\Model\DataObject\MediaCategory
  183. */
  184. public function setLegacyId($legacyId)
  185. {
  186.     $this->legacyId $legacyId;
  187.     return $this;
  188. }
  189. }