var/classes/DataObject/Products.php line 150

Open in your IDE?
  1. <?php
  2. /**
  3. * Inheritance: yes
  4. * Variants: no
  5. Fields Summary:
  6. - localizedfields [localizedfields]
  7. -- name [input]
  8. -- description [textarea]
  9. -- ingredients [textarea]
  10. -- size [input]
  11. -- meta_title [input]
  12. -- meta_description [textarea]
  13. - featured [booleanSelect]
  14. - code [input]
  15. - cuisine [select]
  16. - meal_type [select]
  17. - productattr [manyToManyObjectRelation]
  18. - categories [manyToManyObjectRelation]
  19. - subCategory [manyToOneRelation]
  20. - brands [manyToOneRelation]
  21. - recipes [manyToManyObjectRelation]
  22. - bought_with [manyToManyObjectRelation]
  23. - related_products [manyToManyObjectRelation]
  24. - image [image]
  25. - url [input]
  26. - region [block]
  27. -- country [country]
  28. -- price [numeric]
  29. -- currency_symbol [input]
  30. - usage_info [block]
  31. -- localizedfields [localizedfields]
  32. --- usage_property [input]
  33. --- usage_value [input]
  34. - nutritionspersize [input]
  35. - nutrition [block]
  36. -- localizedfields [localizedfields]
  37. --- nutritions [input]
  38. --- qty [input]
  39. - attrimage [imageGallery]
  40. - product_info [block]
  41. -- localizedfields [localizedfields]
  42. --- product_info_name [input]
  43. --- product_info_value [input]
  44. */
  45. namespace Pimcore\Model\DataObject;
  46. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  47. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  48. /**
  49. * @method static \Pimcore\Model\DataObject\Products\Listing getList(array $config = [])
  50. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  51. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  52. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  53. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByIngredients($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  54. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getBySize($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  55. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByMeta_title($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  56. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByMeta_description($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  57. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByCode($value, $limit = 0, $offset = 0, $objectTypes = null)
  58. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByCuisine($value, $limit = 0, $offset = 0, $objectTypes = null)
  59. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByMeal_type($value, $limit = 0, $offset = 0, $objectTypes = null)
  60. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByProductattr($value, $limit = 0, $offset = 0, $objectTypes = null)
  61. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByCategories($value, $limit = 0, $offset = 0, $objectTypes = null)
  62. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getBySubCategory($value, $limit = 0, $offset = 0, $objectTypes = null)
  63. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByBrands($value, $limit = 0, $offset = 0, $objectTypes = null)
  64. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByRecipes($value, $limit = 0, $offset = 0, $objectTypes = null)
  65. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByBought_with($value, $limit = 0, $offset = 0, $objectTypes = null)
  66. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByRelated_products($value, $limit = 0, $offset = 0, $objectTypes = null)
  67. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  68. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByUrl($value, $limit = 0, $offset = 0, $objectTypes = null)
  69. * @method static \Pimcore\Model\DataObject\Products\Listing|\Pimcore\Model\DataObject\Products|null getByNutritionspersize($value, $limit = 0, $offset = 0, $objectTypes = null)
  70. */
  71. class Products extends \App\Model\Product\AbstractProduct
  72. {
  73. protected $o_classId "1";
  74. protected $o_className "products";
  75. protected $localizedfields;
  76. protected $featured;
  77. protected $code;
  78. protected $cuisine;
  79. protected $meal_type;
  80. protected $productattr;
  81. protected $categories;
  82. protected $subCategory;
  83. protected $brands;
  84. protected $recipes;
  85. protected $bought_with;
  86. protected $related_products;
  87. protected $image;
  88. protected $url;
  89. protected $region;
  90. protected $usage_info;
  91. protected $nutritionspersize;
  92. protected $nutrition;
  93. protected $attrimage;
  94. protected $product_info;
  95. /**
  96. * @param array $values
  97. * @return \Pimcore\Model\DataObject\Products
  98. */
  99. public static function create($values = array()) {
  100.     $object = new static();
  101.     $object->setValues($values);
  102.     return $object;
  103. }
  104. /**
  105. * Get localizedfields - Language
  106. * @return \Pimcore\Model\DataObject\Localizedfield|null
  107. */
  108. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  109. {
  110.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  111.         $preValue $this->preGetValue("localizedfields");
  112.         if ($preValue !== null) {
  113.             return $preValue;
  114.         }
  115.     }
  116.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  117.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("localizedfields")->isEmpty($data)) {
  118.         try {
  119.             return $this->getValueFromParent("localizedfields");
  120.         } catch (InheritanceParentNotFoundException $e) {
  121.             // no data from parent available, continue ...
  122.         }
  123.     }
  124.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  125.         return $data->getPlain();
  126.     }
  127.     return $data;
  128. }
  129. /**
  130. * Get name - Name
  131. * @return string|null
  132. */
  133. public function getName($language null): ?string
  134. {
  135.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  136.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  137.         $preValue $this->preGetValue("name");
  138.         if ($preValue !== null) {
  139.             return $preValue;
  140.         }
  141.     }
  142.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  143.         return $data->getPlain();
  144.     }
  145.     return $data;
  146. }
  147. /**
  148. * Get description - Description
  149. * @return string|null
  150. */
  151. public function getDescription($language null): ?string
  152. {
  153.     $data $this->getLocalizedfields()->getLocalizedValue("description"$language);
  154.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  155.         $preValue $this->preGetValue("description");
  156.         if ($preValue !== null) {
  157.             return $preValue;
  158.         }
  159.     }
  160.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  161.         return $data->getPlain();
  162.     }
  163.     return $data;
  164. }
  165. /**
  166. * Get ingredients - ingredients
  167. * @return string|null
  168. */
  169. public function getIngredients($language null): ?string
  170. {
  171.     $data $this->getLocalizedfields()->getLocalizedValue("ingredients"$language);
  172.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  173.         $preValue $this->preGetValue("ingredients");
  174.         if ($preValue !== null) {
  175.             return $preValue;
  176.         }
  177.     }
  178.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  179.         return $data->getPlain();
  180.     }
  181.     return $data;
  182. }
  183. /**
  184. * Get size - Size
  185. * @return string|null
  186. */
  187. public function getSize($language null): ?string
  188. {
  189.     $data $this->getLocalizedfields()->getLocalizedValue("size"$language);
  190.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  191.         $preValue $this->preGetValue("size");
  192.         if ($preValue !== null) {
  193.             return $preValue;
  194.         }
  195.     }
  196.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  197.         return $data->getPlain();
  198.     }
  199.     return $data;
  200. }
  201. /**
  202. * Get meta_title - Meta Title
  203. * @return string|null
  204. */
  205. public function getMeta_title($language null): ?string
  206. {
  207.     $data $this->getLocalizedfields()->getLocalizedValue("meta_title"$language);
  208.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  209.         $preValue $this->preGetValue("meta_title");
  210.         if ($preValue !== null) {
  211.             return $preValue;
  212.         }
  213.     }
  214.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  215.         return $data->getPlain();
  216.     }
  217.     return $data;
  218. }
  219. /**
  220. * Get meta_description - Meta Description
  221. * @return string|null
  222. */
  223. public function getMeta_description($language null): ?string
  224. {
  225.     $data $this->getLocalizedfields()->getLocalizedValue("meta_description"$language);
  226.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  227.         $preValue $this->preGetValue("meta_description");
  228.         if ($preValue !== null) {
  229.             return $preValue;
  230.         }
  231.     }
  232.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  233.         return $data->getPlain();
  234.     }
  235.     return $data;
  236. }
  237. /**
  238. * Set localizedfields - Language
  239. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  240. * @return \Pimcore\Model\DataObject\Products
  241. */
  242. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  243. {
  244.     $inheritValues self::getGetInheritedValues();
  245.     self::setGetInheritedValues(false);
  246.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  247.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  248.     $currentData $this->getLocalizedfields();
  249.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  250.     self::setGetInheritedValues($inheritValues);
  251.     $this->markFieldDirty("localizedfields"true);
  252.     $this->localizedfields $localizedfields;
  253.     return $this;
  254. }
  255. /**
  256. * Set name - Name
  257. * @param string|null $name
  258. * @return \Pimcore\Model\DataObject\Products
  259. */
  260. public function setName (?string $name$language null)
  261. {
  262.     $isEqual false;
  263.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  264.     return $this;
  265. }
  266. /**
  267. * Set description - Description
  268. * @param string|null $description
  269. * @return \Pimcore\Model\DataObject\Products
  270. */
  271. public function setDescription (?string $description$language null)
  272. {
  273.     $isEqual false;
  274.     $this->getLocalizedfields()->setLocalizedValue("description"$description$language, !$isEqual);
  275.     return $this;
  276. }
  277. /**
  278. * Set ingredients - ingredients
  279. * @param string|null $ingredients
  280. * @return \Pimcore\Model\DataObject\Products
  281. */
  282. public function setIngredients (?string $ingredients$language null)
  283. {
  284.     $isEqual false;
  285.     $this->getLocalizedfields()->setLocalizedValue("ingredients"$ingredients$language, !$isEqual);
  286.     return $this;
  287. }
  288. /**
  289. * Set size - Size
  290. * @param string|null $size
  291. * @return \Pimcore\Model\DataObject\Products
  292. */
  293. public function setSize (?string $size$language null)
  294. {
  295.     $isEqual false;
  296.     $this->getLocalizedfields()->setLocalizedValue("size"$size$language, !$isEqual);
  297.     return $this;
  298. }
  299. /**
  300. * Set meta_title - Meta Title
  301. * @param string|null $meta_title
  302. * @return \Pimcore\Model\DataObject\Products
  303. */
  304. public function setMeta_title (?string $meta_title$language null)
  305. {
  306.     $isEqual false;
  307.     $this->getLocalizedfields()->setLocalizedValue("meta_title"$meta_title$language, !$isEqual);
  308.     return $this;
  309. }
  310. /**
  311. * Set meta_description - Meta Description
  312. * @param string|null $meta_description
  313. * @return \Pimcore\Model\DataObject\Products
  314. */
  315. public function setMeta_description (?string $meta_description$language null)
  316. {
  317.     $isEqual false;
  318.     $this->getLocalizedfields()->setLocalizedValue("meta_description"$meta_description$language, !$isEqual);
  319.     return $this;
  320. }
  321. /**
  322. * Get featured - Featured Product
  323. * @return bool|null
  324. */
  325. public function getFeatured(): ?bool
  326. {
  327.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  328.         $preValue $this->preGetValue("featured");
  329.         if ($preValue !== null) {
  330.             return $preValue;
  331.         }
  332.     }
  333.     $data $this->featured;
  334.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("featured")->isEmpty($data)) {
  335.         try {
  336.             return $this->getValueFromParent("featured");
  337.         } catch (InheritanceParentNotFoundException $e) {
  338.             // no data from parent available, continue ...
  339.         }
  340.     }
  341.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  342.         return $data->getPlain();
  343.     }
  344.     return $data;
  345. }
  346. /**
  347. * Set featured - Featured Product
  348. * @param bool|null $featured
  349. * @return \Pimcore\Model\DataObject\Products
  350. */
  351. public function setFeatured(?bool $featured)
  352. {
  353.     $this->featured $featured;
  354.     return $this;
  355. }
  356. /**
  357. * Get code - code
  358. * @return string|null
  359. */
  360. public function getCode(): ?string
  361. {
  362.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  363.         $preValue $this->preGetValue("code");
  364.         if ($preValue !== null) {
  365.             return $preValue;
  366.         }
  367.     }
  368.     $data $this->code;
  369.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("code")->isEmpty($data)) {
  370.         try {
  371.             return $this->getValueFromParent("code");
  372.         } catch (InheritanceParentNotFoundException $e) {
  373.             // no data from parent available, continue ...
  374.         }
  375.     }
  376.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  377.         return $data->getPlain();
  378.     }
  379.     return $data;
  380. }
  381. /**
  382. * Set code - code
  383. * @param string|null $code
  384. * @return \Pimcore\Model\DataObject\Products
  385. */
  386. public function setCode(?string $code)
  387. {
  388.     $this->code $code;
  389.     return $this;
  390. }
  391. /**
  392. * Get cuisine - Cuisine
  393. * @return string|null
  394. */
  395. public function getCuisine(): ?string
  396. {
  397.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  398.         $preValue $this->preGetValue("cuisine");
  399.         if ($preValue !== null) {
  400.             return $preValue;
  401.         }
  402.     }
  403.     $data $this->cuisine;
  404.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("cuisine")->isEmpty($data)) {
  405.         try {
  406.             return $this->getValueFromParent("cuisine");
  407.         } catch (InheritanceParentNotFoundException $e) {
  408.             // no data from parent available, continue ...
  409.         }
  410.     }
  411.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  412.         return $data->getPlain();
  413.     }
  414.     return $data;
  415. }
  416. /**
  417. * Set cuisine - Cuisine
  418. * @param string|null $cuisine
  419. * @return \Pimcore\Model\DataObject\Products
  420. */
  421. public function setCuisine(?string $cuisine)
  422. {
  423.     $this->cuisine $cuisine;
  424.     return $this;
  425. }
  426. /**
  427. * Get meal_type - Meal Type
  428. * @return string|null
  429. */
  430. public function getMeal_type(): ?string
  431. {
  432.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  433.         $preValue $this->preGetValue("meal_type");
  434.         if ($preValue !== null) {
  435.             return $preValue;
  436.         }
  437.     }
  438.     $data $this->meal_type;
  439.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("meal_type")->isEmpty($data)) {
  440.         try {
  441.             return $this->getValueFromParent("meal_type");
  442.         } catch (InheritanceParentNotFoundException $e) {
  443.             // no data from parent available, continue ...
  444.         }
  445.     }
  446.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  447.         return $data->getPlain();
  448.     }
  449.     return $data;
  450. }
  451. /**
  452. * Set meal_type - Meal Type
  453. * @param string|null $meal_type
  454. * @return \Pimcore\Model\DataObject\Products
  455. */
  456. public function setMeal_type(?string $meal_type)
  457. {
  458.     $this->meal_type $meal_type;
  459.     return $this;
  460. }
  461. /**
  462. * Get productattr - Product Attributes
  463. * @return \Pimcore\Model\DataObject\Productattribute[]
  464. */
  465. public function getProductattr(): array
  466. {
  467.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  468.         $preValue $this->preGetValue("productattr");
  469.         if ($preValue !== null) {
  470.             return $preValue;
  471.         }
  472.     }
  473.     $data $this->getClass()->getFieldDefinition("productattr")->preGetData($this);
  474.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("productattr")->isEmpty($data)) {
  475.         try {
  476.             return $this->getValueFromParent("productattr");
  477.         } catch (InheritanceParentNotFoundException $e) {
  478.             // no data from parent available, continue ...
  479.         }
  480.     }
  481.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  482.         return $data->getPlain();
  483.     }
  484.     return $data;
  485. }
  486. /**
  487. * Set productattr - Product Attributes
  488. * @param \Pimcore\Model\DataObject\Productattribute[] $productattr
  489. * @return \Pimcore\Model\DataObject\Products
  490. */
  491. public function setProductattr(?array $productattr)
  492. {
  493.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  494.     $fd $this->getClass()->getFieldDefinition("productattr");
  495.     $inheritValues self::getGetInheritedValues();
  496.     self::setGetInheritedValues(false);
  497.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  498.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  499.     $currentData $this->getProductattr();
  500.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  501.     self::setGetInheritedValues($inheritValues);
  502.     $isEqual $fd->isEqual($currentData$productattr);
  503.     if (!$isEqual) {
  504.         $this->markFieldDirty("productattr"true);
  505.     }
  506.     $this->productattr $fd->preSetData($this$productattr);
  507.     return $this;
  508. }
  509. /**
  510. * Get categories - Categories
  511. * @return \Pimcore\Model\DataObject\Category[]
  512. */
  513. public function getCategories(): array
  514. {
  515.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  516.         $preValue $this->preGetValue("categories");
  517.         if ($preValue !== null) {
  518.             return $preValue;
  519.         }
  520.     }
  521.     $data $this->getClass()->getFieldDefinition("categories")->preGetData($this);
  522.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("categories")->isEmpty($data)) {
  523.         try {
  524.             return $this->getValueFromParent("categories");
  525.         } catch (InheritanceParentNotFoundException $e) {
  526.             // no data from parent available, continue ...
  527.         }
  528.     }
  529.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  530.         return $data->getPlain();
  531.     }
  532.     return $data;
  533. }
  534. /**
  535. * Set categories - Categories
  536. * @param \Pimcore\Model\DataObject\Category[] $categories
  537. * @return \Pimcore\Model\DataObject\Products
  538. */
  539. public function setCategories(?array $categories)
  540. {
  541.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  542.     $fd $this->getClass()->getFieldDefinition("categories");
  543.     $inheritValues self::getGetInheritedValues();
  544.     self::setGetInheritedValues(false);
  545.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  546.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  547.     $currentData $this->getCategories();
  548.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  549.     self::setGetInheritedValues($inheritValues);
  550.     $isEqual $fd->isEqual($currentData$categories);
  551.     if (!$isEqual) {
  552.         $this->markFieldDirty("categories"true);
  553.     }
  554.     $this->categories $fd->preSetData($this$categories);
  555.     return $this;
  556. }
  557. /**
  558. * Get subCategory - Sub Category
  559. * @return \Pimcore\Model\DataObject\SubCategory|null
  560. */
  561. public function getSubCategory(): ?\Pimcore\Model\Element\AbstractElement
  562. {
  563.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  564.         $preValue $this->preGetValue("subCategory");
  565.         if ($preValue !== null) {
  566.             return $preValue;
  567.         }
  568.     }
  569.     $data $this->getClass()->getFieldDefinition("subCategory")->preGetData($this);
  570.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("subCategory")->isEmpty($data)) {
  571.         try {
  572.             return $this->getValueFromParent("subCategory");
  573.         } catch (InheritanceParentNotFoundException $e) {
  574.             // no data from parent available, continue ...
  575.         }
  576.     }
  577.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  578.         return $data->getPlain();
  579.     }
  580.     return $data;
  581. }
  582. /**
  583. * Set subCategory - Sub Category
  584. * @param \Pimcore\Model\DataObject\SubCategory $subCategory
  585. * @return \Pimcore\Model\DataObject\Products
  586. */
  587. public function setSubCategory(?\Pimcore\Model\Element\AbstractElement $subCategory)
  588. {
  589.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  590.     $fd $this->getClass()->getFieldDefinition("subCategory");
  591.     $inheritValues self::getGetInheritedValues();
  592.     self::setGetInheritedValues(false);
  593.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  594.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  595.     $currentData $this->getSubCategory();
  596.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  597.     self::setGetInheritedValues($inheritValues);
  598.     $isEqual $fd->isEqual($currentData$subCategory);
  599.     if (!$isEqual) {
  600.         $this->markFieldDirty("subCategory"true);
  601.     }
  602.     $this->subCategory $fd->preSetData($this$subCategory);
  603.     return $this;
  604. }
  605. /**
  606. * Get brands - Brands
  607. * @return \Pimcore\Model\DataObject\Brands|null
  608. */
  609. public function getBrands(): ?\Pimcore\Model\Element\AbstractElement
  610. {
  611.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  612.         $preValue $this->preGetValue("brands");
  613.         if ($preValue !== null) {
  614.             return $preValue;
  615.         }
  616.     }
  617.     $data $this->getClass()->getFieldDefinition("brands")->preGetData($this);
  618.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("brands")->isEmpty($data)) {
  619.         try {
  620.             return $this->getValueFromParent("brands");
  621.         } catch (InheritanceParentNotFoundException $e) {
  622.             // no data from parent available, continue ...
  623.         }
  624.     }
  625.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  626.         return $data->getPlain();
  627.     }
  628.     return $data;
  629. }
  630. /**
  631. * Set brands - Brands
  632. * @param \Pimcore\Model\DataObject\Brands $brands
  633. * @return \Pimcore\Model\DataObject\Products
  634. */
  635. public function setBrands(?\Pimcore\Model\Element\AbstractElement $brands)
  636. {
  637.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  638.     $fd $this->getClass()->getFieldDefinition("brands");
  639.     $inheritValues self::getGetInheritedValues();
  640.     self::setGetInheritedValues(false);
  641.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  642.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  643.     $currentData $this->getBrands();
  644.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  645.     self::setGetInheritedValues($inheritValues);
  646.     $isEqual $fd->isEqual($currentData$brands);
  647.     if (!$isEqual) {
  648.         $this->markFieldDirty("brands"true);
  649.     }
  650.     $this->brands $fd->preSetData($this$brands);
  651.     return $this;
  652. }
  653. /**
  654. * Get recipes - Recipes
  655. * @return \Pimcore\Model\DataObject\Recipe[]
  656. */
  657. public function getRecipes(): array
  658. {
  659.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  660.         $preValue $this->preGetValue("recipes");
  661.         if ($preValue !== null) {
  662.             return $preValue;
  663.         }
  664.     }
  665.     $data $this->getClass()->getFieldDefinition("recipes")->preGetData($this);
  666.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("recipes")->isEmpty($data)) {
  667.         try {
  668.             return $this->getValueFromParent("recipes");
  669.         } catch (InheritanceParentNotFoundException $e) {
  670.             // no data from parent available, continue ...
  671.         }
  672.     }
  673.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  674.         return $data->getPlain();
  675.     }
  676.     return $data;
  677. }
  678. /**
  679. * Set recipes - Recipes
  680. * @param \Pimcore\Model\DataObject\Recipe[] $recipes
  681. * @return \Pimcore\Model\DataObject\Products
  682. */
  683. public function setRecipes(?array $recipes)
  684. {
  685.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  686.     $fd $this->getClass()->getFieldDefinition("recipes");
  687.     $inheritValues self::getGetInheritedValues();
  688.     self::setGetInheritedValues(false);
  689.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  690.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  691.     $currentData $this->getRecipes();
  692.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  693.     self::setGetInheritedValues($inheritValues);
  694.     $isEqual $fd->isEqual($currentData$recipes);
  695.     if (!$isEqual) {
  696.         $this->markFieldDirty("recipes"true);
  697.     }
  698.     $this->recipes $fd->preSetData($this$recipes);
  699.     return $this;
  700. }
  701. /**
  702. * Get bought_with - Bought Together
  703. * @return \Pimcore\Model\DataObject\Products[]
  704. */
  705. public function getBought_with(): array
  706. {
  707.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  708.         $preValue $this->preGetValue("bought_with");
  709.         if ($preValue !== null) {
  710.             return $preValue;
  711.         }
  712.     }
  713.     $data $this->getClass()->getFieldDefinition("bought_with")->preGetData($this);
  714.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("bought_with")->isEmpty($data)) {
  715.         try {
  716.             return $this->getValueFromParent("bought_with");
  717.         } catch (InheritanceParentNotFoundException $e) {
  718.             // no data from parent available, continue ...
  719.         }
  720.     }
  721.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  722.         return $data->getPlain();
  723.     }
  724.     return $data;
  725. }
  726. /**
  727. * Set bought_with - Bought Together
  728. * @param \Pimcore\Model\DataObject\Products[] $bought_with
  729. * @return \Pimcore\Model\DataObject\Products
  730. */
  731. public function setBought_with(?array $bought_with)
  732. {
  733.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  734.     $fd $this->getClass()->getFieldDefinition("bought_with");
  735.     $inheritValues self::getGetInheritedValues();
  736.     self::setGetInheritedValues(false);
  737.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  738.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  739.     $currentData $this->getBought_with();
  740.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  741.     self::setGetInheritedValues($inheritValues);
  742.     $isEqual $fd->isEqual($currentData$bought_with);
  743.     if (!$isEqual) {
  744.         $this->markFieldDirty("bought_with"true);
  745.     }
  746.     $this->bought_with $fd->preSetData($this$bought_with);
  747.     return $this;
  748. }
  749. /**
  750. * Get related_products - Related Products
  751. * @return \Pimcore\Model\DataObject\Products[]
  752. */
  753. public function getRelated_products(): array
  754. {
  755.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  756.         $preValue $this->preGetValue("related_products");
  757.         if ($preValue !== null) {
  758.             return $preValue;
  759.         }
  760.     }
  761.     $data $this->getClass()->getFieldDefinition("related_products")->preGetData($this);
  762.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("related_products")->isEmpty($data)) {
  763.         try {
  764.             return $this->getValueFromParent("related_products");
  765.         } catch (InheritanceParentNotFoundException $e) {
  766.             // no data from parent available, continue ...
  767.         }
  768.     }
  769.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  770.         return $data->getPlain();
  771.     }
  772.     return $data;
  773. }
  774. /**
  775. * Set related_products - Related Products
  776. * @param \Pimcore\Model\DataObject\Products[] $related_products
  777. * @return \Pimcore\Model\DataObject\Products
  778. */
  779. public function setRelated_products(?array $related_products)
  780. {
  781.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  782.     $fd $this->getClass()->getFieldDefinition("related_products");
  783.     $inheritValues self::getGetInheritedValues();
  784.     self::setGetInheritedValues(false);
  785.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  786.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  787.     $currentData $this->getRelated_products();
  788.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  789.     self::setGetInheritedValues($inheritValues);
  790.     $isEqual $fd->isEqual($currentData$related_products);
  791.     if (!$isEqual) {
  792.         $this->markFieldDirty("related_products"true);
  793.     }
  794.     $this->related_products $fd->preSetData($this$related_products);
  795.     return $this;
  796. }
  797. /**
  798. * Get image - image
  799. * @return \Pimcore\Model\Asset\Image|null
  800. */
  801. public function getImage(): ?\Pimcore\Model\Asset\Image
  802. {
  803.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  804.         $preValue $this->preGetValue("image");
  805.         if ($preValue !== null) {
  806.             return $preValue;
  807.         }
  808.     }
  809.     $data $this->image;
  810.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("image")->isEmpty($data)) {
  811.         try {
  812.             return $this->getValueFromParent("image");
  813.         } catch (InheritanceParentNotFoundException $e) {
  814.             // no data from parent available, continue ...
  815.         }
  816.     }
  817.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  818.         return $data->getPlain();
  819.     }
  820.     return $data;
  821. }
  822. /**
  823. * Set image - image
  824. * @param \Pimcore\Model\Asset\Image|null $image
  825. * @return \Pimcore\Model\DataObject\Products
  826. */
  827. public function setImage(?\Pimcore\Model\Asset\Image $image)
  828. {
  829.     $this->image $image;
  830.     return $this;
  831. }
  832. /**
  833. * Get url - Url
  834. * @return string|null
  835. */
  836. public function getUrl(): ?string
  837. {
  838.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  839.         $preValue $this->preGetValue("url");
  840.         if ($preValue !== null) {
  841.             return $preValue;
  842.         }
  843.     }
  844.     $data $this->url;
  845.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("url")->isEmpty($data)) {
  846.         try {
  847.             return $this->getValueFromParent("url");
  848.         } catch (InheritanceParentNotFoundException $e) {
  849.             // no data from parent available, continue ...
  850.         }
  851.     }
  852.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  853.         return $data->getPlain();
  854.     }
  855.     return $data;
  856. }
  857. /**
  858. * Set url - Url
  859. * @param string|null $url
  860. * @return \Pimcore\Model\DataObject\Products
  861. */
  862. public function setUrl(?string $url)
  863. {
  864.     $this->url $url;
  865.     return $this;
  866. }
  867. /**
  868. * Get region - region
  869. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  870. */
  871. public function getRegion(): ?array
  872. {
  873.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  874.         $preValue $this->preGetValue("region");
  875.         if ($preValue !== null) {
  876.             return $preValue;
  877.         }
  878.     }
  879.     $data $this->getClass()->getFieldDefinition("region")->preGetData($this);
  880.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("region")->isEmpty($data)) {
  881.         try {
  882.             return $this->getValueFromParent("region");
  883.         } catch (InheritanceParentNotFoundException $e) {
  884.             // no data from parent available, continue ...
  885.         }
  886.     }
  887.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  888.         return $data->getPlain();
  889.     }
  890.     return $data;
  891. }
  892. /**
  893. * Set region - region
  894. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $region
  895. * @return \Pimcore\Model\DataObject\Products
  896. */
  897. public function setRegion(?array $region)
  898. {
  899.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  900.     $fd $this->getClass()->getFieldDefinition("region");
  901.     $this->region $fd->preSetData($this$region);
  902.     return $this;
  903. }
  904. /**
  905. * Get usage_info - usage_info
  906. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  907. */
  908. public function getUsage_info(): ?array
  909. {
  910.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  911.         $preValue $this->preGetValue("usage_info");
  912.         if ($preValue !== null) {
  913.             return $preValue;
  914.         }
  915.     }
  916.     $data $this->getClass()->getFieldDefinition("usage_info")->preGetData($this);
  917.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("usage_info")->isEmpty($data)) {
  918.         try {
  919.             return $this->getValueFromParent("usage_info");
  920.         } catch (InheritanceParentNotFoundException $e) {
  921.             // no data from parent available, continue ...
  922.         }
  923.     }
  924.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  925.         return $data->getPlain();
  926.     }
  927.     return $data;
  928. }
  929. /**
  930. * Set usage_info - usage_info
  931. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $usage_info
  932. * @return \Pimcore\Model\DataObject\Products
  933. */
  934. public function setUsage_info(?array $usage_info)
  935. {
  936.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  937.     $fd $this->getClass()->getFieldDefinition("usage_info");
  938.     $this->usage_info $fd->preSetData($this$usage_info);
  939.     return $this;
  940. }
  941. /**
  942. * Get nutritionspersize - Nutrition Per Size
  943. * @return string|null
  944. */
  945. public function getNutritionspersize(): ?string
  946. {
  947.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  948.         $preValue $this->preGetValue("nutritionspersize");
  949.         if ($preValue !== null) {
  950.             return $preValue;
  951.         }
  952.     }
  953.     $data $this->nutritionspersize;
  954.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("nutritionspersize")->isEmpty($data)) {
  955.         try {
  956.             return $this->getValueFromParent("nutritionspersize");
  957.         } catch (InheritanceParentNotFoundException $e) {
  958.             // no data from parent available, continue ...
  959.         }
  960.     }
  961.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  962.         return $data->getPlain();
  963.     }
  964.     return $data;
  965. }
  966. /**
  967. * Set nutritionspersize - Nutrition Per Size
  968. * @param string|null $nutritionspersize
  969. * @return \Pimcore\Model\DataObject\Products
  970. */
  971. public function setNutritionspersize(?string $nutritionspersize)
  972. {
  973.     $this->nutritionspersize $nutritionspersize;
  974.     return $this;
  975. }
  976. /**
  977. * Get nutrition - Nutrition
  978. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  979. */
  980. public function getNutrition(): ?array
  981. {
  982.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  983.         $preValue $this->preGetValue("nutrition");
  984.         if ($preValue !== null) {
  985.             return $preValue;
  986.         }
  987.     }
  988.     $data $this->getClass()->getFieldDefinition("nutrition")->preGetData($this);
  989.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("nutrition")->isEmpty($data)) {
  990.         try {
  991.             return $this->getValueFromParent("nutrition");
  992.         } catch (InheritanceParentNotFoundException $e) {
  993.             // no data from parent available, continue ...
  994.         }
  995.     }
  996.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  997.         return $data->getPlain();
  998.     }
  999.     return $data;
  1000. }
  1001. /**
  1002. * Set nutrition - Nutrition
  1003. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $nutrition
  1004. * @return \Pimcore\Model\DataObject\Products
  1005. */
  1006. public function setNutrition(?array $nutrition)
  1007. {
  1008.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  1009.     $fd $this->getClass()->getFieldDefinition("nutrition");
  1010.     $this->nutrition $fd->preSetData($this$nutrition);
  1011.     return $this;
  1012. }
  1013. /**
  1014. * Get attrimage - attrimage
  1015. * @return \Pimcore\Model\DataObject\Data\ImageGallery|null
  1016. */
  1017. public function getAttrimage(): ?\Pimcore\Model\DataObject\Data\ImageGallery
  1018. {
  1019.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  1020.         $preValue $this->preGetValue("attrimage");
  1021.         if ($preValue !== null) {
  1022.             return $preValue;
  1023.         }
  1024.     }
  1025.     $data $this->attrimage;
  1026.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("attrimage")->isEmpty($data)) {
  1027.         try {
  1028.             return $this->getValueFromParent("attrimage");
  1029.         } catch (InheritanceParentNotFoundException $e) {
  1030.             // no data from parent available, continue ...
  1031.         }
  1032.     }
  1033.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  1034.         return $data->getPlain();
  1035.     }
  1036.     return $data;
  1037. }
  1038. /**
  1039. * Set attrimage - attrimage
  1040. * @param \Pimcore\Model\DataObject\Data\ImageGallery|null $attrimage
  1041. * @return \Pimcore\Model\DataObject\Products
  1042. */
  1043. public function setAttrimage(?\Pimcore\Model\DataObject\Data\ImageGallery $attrimage)
  1044. {
  1045.     $this->attrimage $attrimage;
  1046.     return $this;
  1047. }
  1048. /**
  1049. * Get product_info - Product Info
  1050. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  1051. */
  1052. public function getProduct_info(): ?array
  1053. {
  1054.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  1055.         $preValue $this->preGetValue("product_info");
  1056.         if ($preValue !== null) {
  1057.             return $preValue;
  1058.         }
  1059.     }
  1060.     $data $this->getClass()->getFieldDefinition("product_info")->preGetData($this);
  1061.     if (\Pimcore\Model\DataObject::doGetInheritedValues() && $this->getClass()->getFieldDefinition("product_info")->isEmpty($data)) {
  1062.         try {
  1063.             return $this->getValueFromParent("product_info");
  1064.         } catch (InheritanceParentNotFoundException $e) {
  1065.             // no data from parent available, continue ...
  1066.         }
  1067.     }
  1068.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  1069.         return $data->getPlain();
  1070.     }
  1071.     return $data;
  1072. }
  1073. /**
  1074. * Set product_info - Product Info
  1075. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $product_info
  1076. * @return \Pimcore\Model\DataObject\Products
  1077. */
  1078. public function setProduct_info(?array $product_info)
  1079. {
  1080.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  1081.     $fd $this->getClass()->getFieldDefinition("product_info");
  1082.     $this->product_info $fd->preSetData($this$product_info);
  1083.     return $this;
  1084. }
  1085. }