var/classes/DataObject/ProductCategory.php line 44

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - localizedfields [localizedfields]
  8.  * -- title [input]
  9.  * -- additionalText [input]
  10.  * -- description [wysiwyg]
  11.  * -- displayTitle [input]
  12.  * -- relation [manyToOneRelation]
  13.  * -- teaserDescription [wysiwyg]
  14.  * -- countryRelations [block]
  15.  * --- config [manyToOneRelation]
  16.  * --- countryRelation [manyToOneRelation]
  17.  * --- countryTeaserDescription [wysiwyg]
  18.  * - objectBrick [select]
  19.  * - contactPersons [manyToManyObjectRelation]
  20.  * - image [image]
  21.  */
  22. namespace Pimcore\Model\DataObject;
  23. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  24. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  25. /**
  26. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing getList(array $config = [])
  27. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  28. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  29. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByAdditionalText($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  30. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  31. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByDisplayTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  32. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByRelation($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  33. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByTeaserDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  34. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByCountryRelations($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  35. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByObjectBrick($value, $limit = 0, $offset = 0, $objectTypes = null)
  36. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByContactPersons($value, $limit = 0, $offset = 0, $objectTypes = null)
  37. * @method static \Pimcore\Model\DataObject\ProductCategory\Listing|\Pimcore\Model\DataObject\ProductCategory|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  38. */
  39. class ProductCategory extends Concrete
  40. {
  41. protected $o_classId "ProductCategory";
  42. protected $o_className "ProductCategory";
  43. protected $localizedfields;
  44. protected $objectBrick;
  45. protected $contactPersons;
  46. protected $image;
  47. /**
  48. * @param array $values
  49. * @return \Pimcore\Model\DataObject\ProductCategory
  50. */
  51. public static function create($values = array()) {
  52.     $object = new static();
  53.     $object->setValues($values);
  54.     return $object;
  55. }
  56. /**
  57. * Get localizedfields - 
  58. * @return \Pimcore\Model\DataObject\Localizedfield|null
  59. */
  60. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  61. {
  62.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  63.         $preValue $this->preGetValue("localizedfields");
  64.         if ($preValue !== null) {
  65.             return $preValue;
  66.         }
  67.     }
  68.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  69.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  70.         return $data->getPlain();
  71.     }
  72.     return $data;
  73. }
  74. /**
  75. * Get title - Title
  76. * @return string|null
  77. */
  78. public function getTitle($language null): ?string
  79. {
  80.     $data $this->getLocalizedfields()->getLocalizedValue("title"$language);
  81.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  82.         $preValue $this->preGetValue("title");
  83.         if ($preValue !== null) {
  84.             return $preValue;
  85.         }
  86.     }
  87.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  88.         return $data->getPlain();
  89.     }
  90.     return $data;
  91. }
  92. /**
  93. * Get additionalText - Additional Text
  94. * @return string|null
  95. */
  96. public function getAdditionalText($language null): ?string
  97. {
  98.     $data $this->getLocalizedfields()->getLocalizedValue("additionalText"$language);
  99.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  100.         $preValue $this->preGetValue("additionalText");
  101.         if ($preValue !== null) {
  102.             return $preValue;
  103.         }
  104.     }
  105.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  106.         return $data->getPlain();
  107.     }
  108.     return $data;
  109. }
  110. /**
  111. * Get description - Description
  112. * @return string|null
  113. */
  114. public function getDescription($language null): ?string
  115. {
  116.     $data $this->getLocalizedfields()->getLocalizedValue("description"$language);
  117.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  118.         $preValue $this->preGetValue("description");
  119.         if ($preValue !== null) {
  120.             return $preValue;
  121.         }
  122.     }
  123.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  124.         return $data->getPlain();
  125.     }
  126.     return $data;
  127. }
  128. /**
  129. * Get displayTitle - Display Title
  130. * @return string|null
  131. */
  132. public function getDisplayTitle($language null): ?string
  133. {
  134.     $data $this->getLocalizedfields()->getLocalizedValue("displayTitle"$language);
  135.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  136.         $preValue $this->preGetValue("displayTitle");
  137.         if ($preValue !== null) {
  138.             return $preValue;
  139.         }
  140.     }
  141.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  142.         return $data->getPlain();
  143.     }
  144.     return $data;
  145. }
  146. /**
  147. * Get relation - Relation
  148. * @return \Pimcore\Model\Document\Page | \Pimcore\Model\Document\Hardlink | \Pimcore\Model\Document\Link|null
  149. */
  150. public function getRelation($language null): ?\Pimcore\Model\Element\AbstractElement
  151. {
  152.     $data $this->getLocalizedfields()->getLocalizedValue("relation"$language);
  153.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  154.         $preValue $this->preGetValue("relation");
  155.         if ($preValue !== null) {
  156.             return $preValue;
  157.         }
  158.     }
  159.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  160.         return $data->getPlain();
  161.     }
  162.     return $data;
  163. }
  164. /**
  165. * Get teaserDescription - Teaser Description
  166. * @return string|null
  167. */
  168. public function getTeaserDescription($language null): ?string
  169. {
  170.     $data $this->getLocalizedfields()->getLocalizedValue("teaserDescription"$language);
  171.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  172.         $preValue $this->preGetValue("teaserDescription");
  173.         if ($preValue !== null) {
  174.             return $preValue;
  175.         }
  176.     }
  177.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  178.         return $data->getPlain();
  179.     }
  180.     return $data;
  181. }
  182. /**
  183. * Get countryRelations - Country Relations
  184. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  185. */
  186. public function getCountryRelations($language null): ?array
  187. {
  188.     $data $this->getLocalizedfields()->getLocalizedValue("countryRelations"$language);
  189.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  190.         $preValue $this->preGetValue("countryRelations");
  191.         if ($preValue !== null) {
  192.             return $preValue;
  193.         }
  194.     }
  195.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  196.         return $data->getPlain();
  197.     }
  198.     return $data;
  199. }
  200. /**
  201. * Set localizedfields - 
  202. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  203. * @return \Pimcore\Model\DataObject\ProductCategory
  204. */
  205. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  206. {
  207.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  208.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  209.     $currentData $this->getLocalizedfields();
  210.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  211.     $this->markFieldDirty("localizedfields"true);
  212.     $this->localizedfields $localizedfields;
  213.     return $this;
  214. }
  215. /**
  216. * Set title - Title
  217. * @param string|null $title
  218. * @return \Pimcore\Model\DataObject\ProductCategory
  219. */
  220. public function setTitle (?string $title$language null)
  221. {
  222.     $isEqual false;
  223.     $this->getLocalizedfields()->setLocalizedValue("title"$title$language, !$isEqual);
  224.     return $this;
  225. }
  226. /**
  227. * Set additionalText - Additional Text
  228. * @param string|null $additionalText
  229. * @return \Pimcore\Model\DataObject\ProductCategory
  230. */
  231. public function setAdditionalText (?string $additionalText$language null)
  232. {
  233.     $isEqual false;
  234.     $this->getLocalizedfields()->setLocalizedValue("additionalText"$additionalText$language, !$isEqual);
  235.     return $this;
  236. }
  237. /**
  238. * Set description - Description
  239. * @param string|null $description
  240. * @return \Pimcore\Model\DataObject\ProductCategory
  241. */
  242. public function setDescription (?string $description$language null)
  243. {
  244.     $isEqual false;
  245.     $this->getLocalizedfields()->setLocalizedValue("description"$description$language, !$isEqual);
  246.     return $this;
  247. }
  248. /**
  249. * Set displayTitle - Display Title
  250. * @param string|null $displayTitle
  251. * @return \Pimcore\Model\DataObject\ProductCategory
  252. */
  253. public function setDisplayTitle (?string $displayTitle$language null)
  254. {
  255.     $isEqual false;
  256.     $this->getLocalizedfields()->setLocalizedValue("displayTitle"$displayTitle$language, !$isEqual);
  257.     return $this;
  258. }
  259. /**
  260. * Set relation - Relation
  261. * @param \Pimcore\Model\Document\Page | \Pimcore\Model\Document\Hardlink | \Pimcore\Model\Document\Link|null $relation
  262. * @return \Pimcore\Model\DataObject\ProductCategory
  263. */
  264. public function setRelation (?\Pimcore\Model\Element\AbstractElement $relation$language null)
  265. {
  266.     $fd $this->getClass()->getFieldDefinition("localizedfields")->getFieldDefinition("relation");
  267.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  268.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  269.     $currentData $this->getRelation($language);
  270.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  271.     $isEqual $fd->isEqual($currentData$relation);
  272.     if (!$isEqual) {
  273.         $this->markFieldDirty("relation"true);
  274.     }
  275.     $this->getLocalizedfields()->setLocalizedValue("relation"$relation$language, !$isEqual);
  276.     return $this;
  277. }
  278. /**
  279. * Set teaserDescription - Teaser Description
  280. * @param string|null $teaserDescription
  281. * @return \Pimcore\Model\DataObject\ProductCategory
  282. */
  283. public function setTeaserDescription (?string $teaserDescription$language null)
  284. {
  285.     $isEqual false;
  286.     $this->getLocalizedfields()->setLocalizedValue("teaserDescription"$teaserDescription$language, !$isEqual);
  287.     return $this;
  288. }
  289. /**
  290. * Set countryRelations - Country Relations
  291. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $countryRelations
  292. * @return \Pimcore\Model\DataObject\ProductCategory
  293. */
  294. public function setCountryRelations (?array $countryRelations$language null)
  295. {
  296.     $isEqual false;
  297.     $this->getLocalizedfields()->setLocalizedValue("countryRelations"$countryRelations$language, !$isEqual);
  298.     return $this;
  299. }
  300. /**
  301. * Get objectBrick - ObjectBrick
  302. * @return string|null
  303. */
  304. public function getObjectBrick(): ?string
  305. {
  306.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  307.         $preValue $this->preGetValue("objectBrick");
  308.         if ($preValue !== null) {
  309.             return $preValue;
  310.         }
  311.     }
  312.     $data $this->objectBrick;
  313.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  314.         return $data->getPlain();
  315.     }
  316.     return $data;
  317. }
  318. /**
  319. * Set objectBrick - ObjectBrick
  320. * @param string|null $objectBrick
  321. * @return \Pimcore\Model\DataObject\ProductCategory
  322. */
  323. public function setObjectBrick(?string $objectBrick)
  324. {
  325.     $this->objectBrick $objectBrick;
  326.     return $this;
  327. }
  328. /**
  329. * Get contactPersons - Contact persons
  330. * @return \Pimcore\Model\DataObject\Contact[]
  331. */
  332. public function getContactPersons(): array
  333. {
  334.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  335.         $preValue $this->preGetValue("contactPersons");
  336.         if ($preValue !== null) {
  337.             return $preValue;
  338.         }
  339.     }
  340.     $data $this->getClass()->getFieldDefinition("contactPersons")->preGetData($this);
  341.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  342.         return $data->getPlain();
  343.     }
  344.     return $data;
  345. }
  346. /**
  347. * Set contactPersons - Contact persons
  348. * @param \Pimcore\Model\DataObject\Contact[] $contactPersons
  349. * @return \Pimcore\Model\DataObject\ProductCategory
  350. */
  351. public function setContactPersons(?array $contactPersons)
  352. {
  353.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  354.     $fd $this->getClass()->getFieldDefinition("contactPersons");
  355.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  356.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  357.     $currentData $this->getContactPersons();
  358.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  359.     $isEqual $fd->isEqual($currentData$contactPersons);
  360.     if (!$isEqual) {
  361.         $this->markFieldDirty("contactPersons"true);
  362.     }
  363.     $this->contactPersons $fd->preSetData($this$contactPersons);
  364.     return $this;
  365. }
  366. /**
  367. * Get image - Image
  368. * @return \Pimcore\Model\Asset\Image|null
  369. */
  370. public function getImage(): ?\Pimcore\Model\Asset\Image
  371. {
  372.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  373.         $preValue $this->preGetValue("image");
  374.         if ($preValue !== null) {
  375.             return $preValue;
  376.         }
  377.     }
  378.     $data $this->image;
  379.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  380.         return $data->getPlain();
  381.     }
  382.     return $data;
  383. }
  384. /**
  385. * Set image - Image
  386. * @param \Pimcore\Model\Asset\Image|null $image
  387. * @return \Pimcore\Model\DataObject\ProductCategory
  388. */
  389. public function setImage(?\Pimcore\Model\Asset\Image $image)
  390. {
  391.     $this->image $image;
  392.     return $this;
  393. }
  394. }