var/classes/DataObject/PackageCategory.php line 25

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