var/classes/DataObject/CoreShopCategory.php line 44

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - URL [input]
  8.  * - localizedfields [localizedfields]
  9.  * -- name [input]
  10.  * -- description [textarea]
  11.  * -- slug [urlSlug]
  12.  * -- mobileMenuImage [image]
  13.  * -- mobileCoverImage [image]
  14.  * -- pimcoreMetaTitle [input]
  15.  * -- pimcoreMetaDescription [textarea]
  16.  * - filter [coreShopFilter]
  17.  * - stores [coreShopStoreMultiselect]
  18.  * - parentCategory [coreShopRelation]
  19.  * - workingName [input]
  20.  */
  21. namespace Pimcore\Model\DataObject;
  22. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  23. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  24. /**
  25. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing getList(array $config = [])
  26. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByURL($value, $limit = 0, $offset = 0, $objectTypes = null)
  27. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  28. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  29. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  30. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getBySlug($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  31. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByMobileMenuImage($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  32. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByMobileCoverImage($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  33. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByPimcoreMetaTitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  34. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByPimcoreMetaDescription($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  35. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByStores($value, $limit = 0, $offset = 0, $objectTypes = null)
  36. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByParentCategory($value, $limit = 0, $offset = 0, $objectTypes = null)
  37. * @method static \Pimcore\Model\DataObject\CoreShopCategory\Listing|\Pimcore\Model\DataObject\CoreShopCategory|null getByWorkingName($value, $limit = 0, $offset = 0, $objectTypes = null)
  38. */
  39. class CoreShopCategory extends \CoreShop\Component\Core\Model\Category
  40. {
  41. protected $o_classId "cs_category";
  42. protected $o_className "CoreShopCategory";
  43. protected $URL;
  44. protected $localizedfields;
  45. protected $filter;
  46. protected $stores;
  47. protected $parentCategory;
  48. protected $workingName;
  49. /**
  50. * @param array $values
  51. * @return \Pimcore\Model\DataObject\CoreShopCategory
  52. */
  53. public static function create($values = array()) {
  54.     $object = new static();
  55.     $object->setValues($values);
  56.     return $object;
  57. }
  58. /**
  59. * Get URL - URL
  60. * @return string|null
  61. */
  62. public function getURL(): ?string
  63. {
  64.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  65.         $preValue $this->preGetValue("URL");
  66.         if ($preValue !== null) {
  67.             return $preValue;
  68.         }
  69.     }
  70.     $data $this->URL;
  71.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  72.         return $data->getPlain();
  73.     }
  74.     return $data;
  75. }
  76. /**
  77. * Set URL - URL
  78. * @param string|null $URL
  79. * @return \Pimcore\Model\DataObject\CoreShopCategory
  80. */
  81. public function setURL(?string $URL)
  82. {
  83.     $this->URL $URL;
  84.     return $this;
  85. }
  86. /**
  87. * Get localizedfields - 
  88. * @return \Pimcore\Model\DataObject\Localizedfield|null
  89. */
  90. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  91. {
  92.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  93.         $preValue $this->preGetValue("localizedfields");
  94.         if ($preValue !== null) {
  95.             return $preValue;
  96.         }
  97.     }
  98.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  99.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  100.         return $data->getPlain();
  101.     }
  102.     return $data;
  103. }
  104. /**
  105. * Get name - coreshop.category.name
  106. * @return string|null
  107. */
  108. public function getName($language null): ?string
  109. {
  110.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  111.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  112.         $preValue $this->preGetValue("name");
  113.         if ($preValue !== null) {
  114.             return $preValue;
  115.         }
  116.     }
  117.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  118.         return $data->getPlain();
  119.     }
  120.     return $data;
  121. }
  122. /**
  123. * Get description - coreshop.category.description
  124. * @return string|null
  125. */
  126. public function getDescription($language null): ?string
  127. {
  128.     $data $this->getLocalizedfields()->getLocalizedValue("description"$language);
  129.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  130.         $preValue $this->preGetValue("description");
  131.         if ($preValue !== null) {
  132.             return $preValue;
  133.         }
  134.     }
  135.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  136.         return $data->getPlain();
  137.     }
  138.     return $data;
  139. }
  140. /**
  141. * Get slug - coreshop.category.slug
  142. * @return \Pimcore\Model\DataObject\Data\UrlSlug[]
  143. */
  144. public function getSlug($language null): ?array
  145. {
  146.     $data $this->getLocalizedfields()->getLocalizedValue("slug"$language);
  147.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  148.         $preValue $this->preGetValue("slug");
  149.         if ($preValue !== null) {
  150.             return $preValue;
  151.         }
  152.     }
  153.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  154.         return $data->getPlain();
  155.     }
  156.     return $data;
  157. }
  158. /**
  159. * Get mobileMenuImage - Mobile Menu Image
  160. * @return \Pimcore\Model\Asset\Image|null
  161. */
  162. public function getMobileMenuImage($language null): ?\Pimcore\Model\Asset\Image
  163. {
  164.     $data $this->getLocalizedfields()->getLocalizedValue("mobileMenuImage"$language);
  165.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  166.         $preValue $this->preGetValue("mobileMenuImage");
  167.         if ($preValue !== null) {
  168.             return $preValue;
  169.         }
  170.     }
  171.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  172.         return $data->getPlain();
  173.     }
  174.     return $data;
  175. }
  176. /**
  177. * Get mobileCoverImage - Mobile Cover Image
  178. * @return \Pimcore\Model\Asset\Image|null
  179. */
  180. public function getMobileCoverImage($language null): ?\Pimcore\Model\Asset\Image
  181. {
  182.     $data $this->getLocalizedfields()->getLocalizedValue("mobileCoverImage"$language);
  183.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  184.         $preValue $this->preGetValue("mobileCoverImage");
  185.         if ($preValue !== null) {
  186.             return $preValue;
  187.         }
  188.     }
  189.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  190.         return $data->getPlain();
  191.     }
  192.     return $data;
  193. }
  194. /**
  195. * Get pimcoreMetaTitle - coreshop.category.seo_meta_title
  196. * @return string|null
  197. */
  198. public function getPimcoreMetaTitle($language null): ?string
  199. {
  200.     $data $this->getLocalizedfields()->getLocalizedValue("pimcoreMetaTitle"$language);
  201.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  202.         $preValue $this->preGetValue("pimcoreMetaTitle");
  203.         if ($preValue !== null) {
  204.             return $preValue;
  205.         }
  206.     }
  207.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  208.         return $data->getPlain();
  209.     }
  210.     return $data;
  211. }
  212. /**
  213. * Get pimcoreMetaDescription - coreshop.category.seo_meta_description
  214. * @return string|null
  215. */
  216. public function getPimcoreMetaDescription($language null): ?string
  217. {
  218.     $data $this->getLocalizedfields()->getLocalizedValue("pimcoreMetaDescription"$language);
  219.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  220.         $preValue $this->preGetValue("pimcoreMetaDescription");
  221.         if ($preValue !== null) {
  222.             return $preValue;
  223.         }
  224.     }
  225.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  226.         return $data->getPlain();
  227.     }
  228.     return $data;
  229. }
  230. /**
  231. * Set localizedfields - 
  232. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  233. * @return \Pimcore\Model\DataObject\CoreShopCategory
  234. */
  235. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  236. {
  237.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  238.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  239.     $currentData $this->getLocalizedfields();
  240.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  241.     $this->markFieldDirty("localizedfields"true);
  242.     $this->localizedfields $localizedfields;
  243.     return $this;
  244. }
  245. /**
  246. * Set name - coreshop.category.name
  247. * @param string|null $name
  248. * @return \Pimcore\Model\DataObject\CoreShopCategory
  249. */
  250. public function setName (?string $name$language null)
  251. {
  252.     $isEqual false;
  253.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  254.     return $this;
  255. }
  256. /**
  257. * Set description - coreshop.category.description
  258. * @param string|null $description
  259. * @return \Pimcore\Model\DataObject\CoreShopCategory
  260. */
  261. public function setDescription (?string $description$language null)
  262. {
  263.     $isEqual false;
  264.     $this->getLocalizedfields()->setLocalizedValue("description"$description$language, !$isEqual);
  265.     return $this;
  266. }
  267. /**
  268. * Set slug - coreshop.category.slug
  269. * @param \Pimcore\Model\DataObject\Data\UrlSlug[] $slug
  270. * @return \Pimcore\Model\DataObject\CoreShopCategory
  271. */
  272. public function setSlug (?array $slug$language null)
  273. {
  274.     $fd $this->getClass()->getFieldDefinition("localizedfields")->getFieldDefinition("slug");
  275.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  276.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  277.     $currentData $this->getSlug($language);
  278.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  279.     $isEqual $fd->isEqual($currentData$slug);
  280.     if (!$isEqual) {
  281.         $this->markFieldDirty("slug"true);
  282.     }
  283.     $this->getLocalizedfields()->setLocalizedValue("slug"$slug$language, !$isEqual);
  284.     return $this;
  285. }
  286. /**
  287. * Set mobileMenuImage - Mobile Menu Image
  288. * @param \Pimcore\Model\Asset\Image|null $mobileMenuImage
  289. * @return \Pimcore\Model\DataObject\CoreShopCategory
  290. */
  291. public function setMobileMenuImage (?\Pimcore\Model\Asset\Image $mobileMenuImage$language null)
  292. {
  293.     $isEqual false;
  294.     $this->getLocalizedfields()->setLocalizedValue("mobileMenuImage"$mobileMenuImage$language, !$isEqual);
  295.     return $this;
  296. }
  297. /**
  298. * Set mobileCoverImage - Mobile Cover Image
  299. * @param \Pimcore\Model\Asset\Image|null $mobileCoverImage
  300. * @return \Pimcore\Model\DataObject\CoreShopCategory
  301. */
  302. public function setMobileCoverImage (?\Pimcore\Model\Asset\Image $mobileCoverImage$language null)
  303. {
  304.     $isEqual false;
  305.     $this->getLocalizedfields()->setLocalizedValue("mobileCoverImage"$mobileCoverImage$language, !$isEqual);
  306.     return $this;
  307. }
  308. /**
  309. * Set pimcoreMetaTitle - coreshop.category.seo_meta_title
  310. * @param string|null $pimcoreMetaTitle
  311. * @return \Pimcore\Model\DataObject\CoreShopCategory
  312. */
  313. public function setPimcoreMetaTitle (?string $pimcoreMetaTitle$language null)
  314. {
  315.     $isEqual false;
  316.     $this->getLocalizedfields()->setLocalizedValue("pimcoreMetaTitle"$pimcoreMetaTitle$language, !$isEqual);
  317.     return $this;
  318. }
  319. /**
  320. * Set pimcoreMetaDescription - coreshop.category.seo_meta_description
  321. * @param string|null $pimcoreMetaDescription
  322. * @return \Pimcore\Model\DataObject\CoreShopCategory
  323. */
  324. public function setPimcoreMetaDescription (?string $pimcoreMetaDescription$language null)
  325. {
  326.     $isEqual false;
  327.     $this->getLocalizedfields()->setLocalizedValue("pimcoreMetaDescription"$pimcoreMetaDescription$language, !$isEqual);
  328.     return $this;
  329. }
  330. /**
  331. * Get filter - coreshop.category.filter
  332. * @return null|\CoreShop\Component\Index\Model\FilterInterface
  333. */
  334. public function getFilter(): ?\CoreShop\Component\Index\Model\FilterInterface
  335. {
  336.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  337.         $preValue $this->preGetValue("filter");
  338.         if ($preValue !== null) {
  339.             return $preValue;
  340.         }
  341.     }
  342.     $data $this->getClass()->getFieldDefinition("filter")->preGetData($this);
  343.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  344.         return $data->getPlain();
  345.     }
  346.     return $data;
  347. }
  348. /**
  349. * Set filter - coreshop.category.filter
  350. * @param null|\CoreShop\Component\Index\Model\FilterInterface $filter
  351. * @return \Pimcore\Model\DataObject\CoreShopCategory
  352. */
  353. public function setFilter(?\CoreShop\Component\Index\Model\FilterInterface $filter)
  354. {
  355.     /** @var \CoreShop\Bundle\IndexBundle\CoreExtension\Filter $fd */
  356.     $fd $this->getClass()->getFieldDefinition("filter");
  357.     $this->filter $fd->preSetData($this$filter);
  358.     return $this;
  359. }
  360. /**
  361. * Get stores - coreshop.category.stores
  362. * @return string[]|null
  363. */
  364. public function getStores(): ?array
  365. {
  366.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  367.         $preValue $this->preGetValue("stores");
  368.         if ($preValue !== null) {
  369.             return $preValue;
  370.         }
  371.     }
  372.     $data $this->getClass()->getFieldDefinition("stores")->preGetData($this);
  373.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  374.         return $data->getPlain();
  375.     }
  376.     return $data;
  377. }
  378. /**
  379. * Set stores - coreshop.category.stores
  380. * @param string[]|null $stores
  381. * @return \Pimcore\Model\DataObject\CoreShopCategory
  382. */
  383. public function setStores(?array $stores)
  384. {
  385.     $this->stores $stores;
  386.     return $this;
  387. }
  388. /**
  389. * Get parentCategory - coreshop.category.parent_category
  390. * @return ?\CoreShop\Component\Product\Model\CategoryInterface
  391. */
  392. public function getParentCategory(): ?\CoreShop\Component\Product\Model\CategoryInterface
  393. {
  394.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  395.         $preValue $this->preGetValue("parentCategory");
  396.         if ($preValue !== null) {
  397.             return $preValue;
  398.         }
  399.     }
  400.     $data $this->getClass()->getFieldDefinition("parentCategory")->preGetData($this);
  401.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  402.         return $data->getPlain();
  403.     }
  404.     return $data;
  405. }
  406. /**
  407. * Set parentCategory - coreshop.category.parent_category
  408. * @param ?\CoreShop\Component\Product\Model\CategoryInterface $parentCategory
  409. * @return \Pimcore\Model\DataObject\CoreShopCategory
  410. */
  411. public function setParentCategory(?\CoreShop\Component\Product\Model\CategoryInterface $parentCategory)
  412. {
  413.     /** @var \CoreShop\Bundle\ResourceBundle\CoreExtension\CoreShopRelation $fd */
  414.     $fd $this->getClass()->getFieldDefinition("parentCategory");
  415.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  416.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  417.     $currentData $this->getParentCategory();
  418.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  419.     $isEqual $fd->isEqual($currentData$parentCategory);
  420.     if (!$isEqual) {
  421.         $this->markFieldDirty("parentCategory"true);
  422.     }
  423.     $this->parentCategory $fd->preSetData($this$parentCategory);
  424.     return $this;
  425. }
  426. /**
  427. * Get workingName - Working Name
  428. * @return string|null
  429. */
  430. public function getWorkingName(): ?string
  431. {
  432.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  433.         $preValue $this->preGetValue("workingName");
  434.         if ($preValue !== null) {
  435.             return $preValue;
  436.         }
  437.     }
  438.     $data $this->workingName;
  439.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  440.         return $data->getPlain();
  441.     }
  442.     return $data;
  443. }
  444. /**
  445. * Set workingName - Working Name
  446. * @param string|null $workingName
  447. * @return \Pimcore\Model\DataObject\CoreShopCategory
  448. */
  449. public function setWorkingName(?string $workingName)
  450. {
  451.     $this->workingName $workingName;
  452.     return $this;
  453. }
  454. }