var/classes/DataObject/Resources.php line 208

Open in your IDE?
  1. <?php
  2. /**
  3. * Inheritance: no
  4. * Variants: no
  5. Fields Summary:
  6. - localizedfields [localizedfields]
  7. -- name [input]
  8. -- main_description [textarea]
  9. -- image [image]
  10. -- resource_banner [image]
  11. -- resource_banner_mobile [image]
  12. -- meta_title [input]
  13. -- meta_description [textarea]
  14. - resources [block]
  15. -- localizedfields [localizedfields]
  16. --- resource_heading [input]
  17. --- description [wysiwyg]
  18. --- resource_image [image]
  19. --- resource_video [video]
  20. - category [manyToOneRelation]
  21. - subcategory [manyToManyObjectRelation]
  22. - related_article [manyToManyObjectRelation]
  23. - mostpopular [booleanSelect]
  24. - url [input]
  25. - references_links [block]
  26. -- references [input]
  27. */
  28. namespace Pimcore\Model\DataObject;
  29. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  30. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  31. /**
  32. * @method static \Pimcore\Model\DataObject\Resources\Listing getList(array $config = [])
  33. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  34. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  35. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByMain_description($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  36. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByImage($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  37. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByResource_banner($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  38. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByResource_banner_mobile($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  39. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByMeta_title($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  40. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByMeta_description($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  41. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByCategory($value, $limit = 0, $offset = 0, $objectTypes = null)
  42. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getBySubcategory($value, $limit = 0, $offset = 0, $objectTypes = null)
  43. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByRelated_article($value, $limit = 0, $offset = 0, $objectTypes = null)
  44. * @method static \Pimcore\Model\DataObject\Resources\Listing|\Pimcore\Model\DataObject\Resources|null getByUrl($value, $limit = 0, $offset = 0, $objectTypes = null)
  45. */
  46. class Resources extends Concrete
  47. {
  48. protected $o_classId "38";
  49. protected $o_className "resources";
  50. protected $localizedfields;
  51. protected $resources;
  52. protected $category;
  53. protected $subcategory;
  54. protected $related_article;
  55. protected $mostpopular;
  56. protected $url;
  57. protected $references_links;
  58. /**
  59. * @param array $values
  60. * @return \Pimcore\Model\DataObject\Resources
  61. */
  62. public static function create($values = array()) {
  63.     $object = new static();
  64.     $object->setValues($values);
  65.     return $object;
  66. }
  67. /**
  68. * Get localizedfields - 
  69. * @return \Pimcore\Model\DataObject\Localizedfield|null
  70. */
  71. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  72. {
  73.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  74.         $preValue $this->preGetValue("localizedfields");
  75.         if ($preValue !== null) {
  76.             return $preValue;
  77.         }
  78.     }
  79.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  80.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  81.         return $data->getPlain();
  82.     }
  83.     return $data;
  84. }
  85. /**
  86. * Get name - Name
  87. * @return string|null
  88. */
  89. public function getName($language null): ?string
  90. {
  91.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  92.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  93.         $preValue $this->preGetValue("name");
  94.         if ($preValue !== null) {
  95.             return $preValue;
  96.         }
  97.     }
  98.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  99.         return $data->getPlain();
  100.     }
  101.     return $data;
  102. }
  103. /**
  104. * Get main_description - Main Description
  105. * @return string|null
  106. */
  107. public function getMain_description($language null): ?string
  108. {
  109.     $data $this->getLocalizedfields()->getLocalizedValue("main_description"$language);
  110.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  111.         $preValue $this->preGetValue("main_description");
  112.         if ($preValue !== null) {
  113.             return $preValue;
  114.         }
  115.     }
  116.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  117.         return $data->getPlain();
  118.     }
  119.     return $data;
  120. }
  121. /**
  122. * Get image - image
  123. * @return \Pimcore\Model\Asset\Image|null
  124. */
  125. public function getImage($language null): ?\Pimcore\Model\Asset\Image
  126. {
  127.     $data $this->getLocalizedfields()->getLocalizedValue("image"$language);
  128.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  129.         $preValue $this->preGetValue("image");
  130.         if ($preValue !== null) {
  131.             return $preValue;
  132.         }
  133.     }
  134.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  135.         return $data->getPlain();
  136.     }
  137.     return $data;
  138. }
  139. /**
  140. * Get resource_banner - Resource Banner
  141. * @return \Pimcore\Model\Asset\Image|null
  142. */
  143. public function getResource_banner($language null): ?\Pimcore\Model\Asset\Image
  144. {
  145.     $data $this->getLocalizedfields()->getLocalizedValue("resource_banner"$language);
  146.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  147.         $preValue $this->preGetValue("resource_banner");
  148.         if ($preValue !== null) {
  149.             return $preValue;
  150.         }
  151.     }
  152.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  153.         return $data->getPlain();
  154.     }
  155.     return $data;
  156. }
  157. /**
  158. * Get resource_banner_mobile - Resource Banner Mobile
  159. * @return \Pimcore\Model\Asset\Image|null
  160. */
  161. public function getResource_banner_mobile($language null): ?\Pimcore\Model\Asset\Image
  162. {
  163.     $data $this->getLocalizedfields()->getLocalizedValue("resource_banner_mobile"$language);
  164.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  165.         $preValue $this->preGetValue("resource_banner_mobile");
  166.         if ($preValue !== null) {
  167.             return $preValue;
  168.         }
  169.     }
  170.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  171.         return $data->getPlain();
  172.     }
  173.     return $data;
  174. }
  175. /**
  176. * Get meta_title - meta_title
  177. * @return string|null
  178. */
  179. public function getMeta_title($language null): ?string
  180. {
  181.     $data $this->getLocalizedfields()->getLocalizedValue("meta_title"$language);
  182.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  183.         $preValue $this->preGetValue("meta_title");
  184.         if ($preValue !== null) {
  185.             return $preValue;
  186.         }
  187.     }
  188.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  189.         return $data->getPlain();
  190.     }
  191.     return $data;
  192. }
  193. /**
  194. * Get meta_description - Meta Description
  195. * @return string|null
  196. */
  197. public function getMeta_description($language null): ?string
  198. {
  199.     $data $this->getLocalizedfields()->getLocalizedValue("meta_description"$language);
  200.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  201.         $preValue $this->preGetValue("meta_description");
  202.         if ($preValue !== null) {
  203.             return $preValue;
  204.         }
  205.     }
  206.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  207.         return $data->getPlain();
  208.     }
  209.     return $data;
  210. }
  211. /**
  212. * Set localizedfields - 
  213. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  214. * @return \Pimcore\Model\DataObject\Resources
  215. */
  216. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  217. {
  218.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  219.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  220.     $currentData $this->getLocalizedfields();
  221.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  222.     $this->markFieldDirty("localizedfields"true);
  223.     $this->localizedfields $localizedfields;
  224.     return $this;
  225. }
  226. /**
  227. * Set name - Name
  228. * @param string|null $name
  229. * @return \Pimcore\Model\DataObject\Resources
  230. */
  231. public function setName (?string $name$language null)
  232. {
  233.     $isEqual false;
  234.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  235.     return $this;
  236. }
  237. /**
  238. * Set main_description - Main Description
  239. * @param string|null $main_description
  240. * @return \Pimcore\Model\DataObject\Resources
  241. */
  242. public function setMain_description (?string $main_description$language null)
  243. {
  244.     $isEqual false;
  245.     $this->getLocalizedfields()->setLocalizedValue("main_description"$main_description$language, !$isEqual);
  246.     return $this;
  247. }
  248. /**
  249. * Set image - image
  250. * @param \Pimcore\Model\Asset\Image|null $image
  251. * @return \Pimcore\Model\DataObject\Resources
  252. */
  253. public function setImage (?\Pimcore\Model\Asset\Image $image$language null)
  254. {
  255.     $isEqual false;
  256.     $this->getLocalizedfields()->setLocalizedValue("image"$image$language, !$isEqual);
  257.     return $this;
  258. }
  259. /**
  260. * Set resource_banner - Resource Banner
  261. * @param \Pimcore\Model\Asset\Image|null $resource_banner
  262. * @return \Pimcore\Model\DataObject\Resources
  263. */
  264. public function setResource_banner (?\Pimcore\Model\Asset\Image $resource_banner$language null)
  265. {
  266.     $isEqual false;
  267.     $this->getLocalizedfields()->setLocalizedValue("resource_banner"$resource_banner$language, !$isEqual);
  268.     return $this;
  269. }
  270. /**
  271. * Set resource_banner_mobile - Resource Banner Mobile
  272. * @param \Pimcore\Model\Asset\Image|null $resource_banner_mobile
  273. * @return \Pimcore\Model\DataObject\Resources
  274. */
  275. public function setResource_banner_mobile (?\Pimcore\Model\Asset\Image $resource_banner_mobile$language null)
  276. {
  277.     $isEqual false;
  278.     $this->getLocalizedfields()->setLocalizedValue("resource_banner_mobile"$resource_banner_mobile$language, !$isEqual);
  279.     return $this;
  280. }
  281. /**
  282. * Set meta_title - meta_title
  283. * @param string|null $meta_title
  284. * @return \Pimcore\Model\DataObject\Resources
  285. */
  286. public function setMeta_title (?string $meta_title$language null)
  287. {
  288.     $isEqual false;
  289.     $this->getLocalizedfields()->setLocalizedValue("meta_title"$meta_title$language, !$isEqual);
  290.     return $this;
  291. }
  292. /**
  293. * Set meta_description - Meta Description
  294. * @param string|null $meta_description
  295. * @return \Pimcore\Model\DataObject\Resources
  296. */
  297. public function setMeta_description (?string $meta_description$language null)
  298. {
  299.     $isEqual false;
  300.     $this->getLocalizedfields()->setLocalizedValue("meta_description"$meta_description$language, !$isEqual);
  301.     return $this;
  302. }
  303. /**
  304. * Get resources - Resources
  305. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  306. */
  307. public function getResources(): ?array
  308. {
  309.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  310.         $preValue $this->preGetValue("resources");
  311.         if ($preValue !== null) {
  312.             return $preValue;
  313.         }
  314.     }
  315.     $data $this->getClass()->getFieldDefinition("resources")->preGetData($this);
  316.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  317.         return $data->getPlain();
  318.     }
  319.     return $data;
  320. }
  321. /**
  322. * Set resources - Resources
  323. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $resources
  324. * @return \Pimcore\Model\DataObject\Resources
  325. */
  326. public function setResources(?array $resources)
  327. {
  328.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  329.     $fd $this->getClass()->getFieldDefinition("resources");
  330.     $this->resources $fd->preSetData($this$resources);
  331.     return $this;
  332. }
  333. /**
  334. * Get category - category
  335. * @return \Pimcore\Model\DataObject\Resourcecategory|null
  336. */
  337. public function getCategory(): ?\Pimcore\Model\Element\AbstractElement
  338. {
  339.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  340.         $preValue $this->preGetValue("category");
  341.         if ($preValue !== null) {
  342.             return $preValue;
  343.         }
  344.     }
  345.     $data $this->getClass()->getFieldDefinition("category")->preGetData($this);
  346.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  347.         return $data->getPlain();
  348.     }
  349.     return $data;
  350. }
  351. /**
  352. * Set category - category
  353. * @param \Pimcore\Model\DataObject\Resourcecategory $category
  354. * @return \Pimcore\Model\DataObject\Resources
  355. */
  356. public function setCategory(?\Pimcore\Model\Element\AbstractElement $category)
  357. {
  358.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  359.     $fd $this->getClass()->getFieldDefinition("category");
  360.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  361.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  362.     $currentData $this->getCategory();
  363.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  364.     $isEqual $fd->isEqual($currentData$category);
  365.     if (!$isEqual) {
  366.         $this->markFieldDirty("category"true);
  367.     }
  368.     $this->category $fd->preSetData($this$category);
  369.     return $this;
  370. }
  371. /**
  372. * Get subcategory - subcategory
  373. * @return \Pimcore\Model\DataObject\Resourcecategory[]
  374. */
  375. public function getSubcategory(): array
  376. {
  377.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  378.         $preValue $this->preGetValue("subcategory");
  379.         if ($preValue !== null) {
  380.             return $preValue;
  381.         }
  382.     }
  383.     $data $this->getClass()->getFieldDefinition("subcategory")->preGetData($this);
  384.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  385.         return $data->getPlain();
  386.     }
  387.     return $data;
  388. }
  389. /**
  390. * Set subcategory - subcategory
  391. * @param \Pimcore\Model\DataObject\Resourcecategory[] $subcategory
  392. * @return \Pimcore\Model\DataObject\Resources
  393. */
  394. public function setSubcategory(?array $subcategory)
  395. {
  396.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  397.     $fd $this->getClass()->getFieldDefinition("subcategory");
  398.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  399.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  400.     $currentData $this->getSubcategory();
  401.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  402.     $isEqual $fd->isEqual($currentData$subcategory);
  403.     if (!$isEqual) {
  404.         $this->markFieldDirty("subcategory"true);
  405.     }
  406.     $this->subcategory $fd->preSetData($this$subcategory);
  407.     return $this;
  408. }
  409. /**
  410. * Get related_article - Related Article
  411. * @return \Pimcore\Model\DataObject\Resources[]
  412. */
  413. public function getRelated_article(): array
  414. {
  415.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  416.         $preValue $this->preGetValue("related_article");
  417.         if ($preValue !== null) {
  418.             return $preValue;
  419.         }
  420.     }
  421.     $data $this->getClass()->getFieldDefinition("related_article")->preGetData($this);
  422.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  423.         return $data->getPlain();
  424.     }
  425.     return $data;
  426. }
  427. /**
  428. * Set related_article - Related Article
  429. * @param \Pimcore\Model\DataObject\Resources[] $related_article
  430. * @return \Pimcore\Model\DataObject\Resources
  431. */
  432. public function setRelated_article(?array $related_article)
  433. {
  434.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  435.     $fd $this->getClass()->getFieldDefinition("related_article");
  436.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  437.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  438.     $currentData $this->getRelated_article();
  439.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  440.     $isEqual $fd->isEqual($currentData$related_article);
  441.     if (!$isEqual) {
  442.         $this->markFieldDirty("related_article"true);
  443.     }
  444.     $this->related_article $fd->preSetData($this$related_article);
  445.     return $this;
  446. }
  447. /**
  448. * Get mostpopular - Most Popular
  449. * @return bool|null
  450. */
  451. public function getMostpopular(): ?bool
  452. {
  453.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  454.         $preValue $this->preGetValue("mostpopular");
  455.         if ($preValue !== null) {
  456.             return $preValue;
  457.         }
  458.     }
  459.     $data $this->mostpopular;
  460.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  461.         return $data->getPlain();
  462.     }
  463.     return $data;
  464. }
  465. /**
  466. * Set mostpopular - Most Popular
  467. * @param bool|null $mostpopular
  468. * @return \Pimcore\Model\DataObject\Resources
  469. */
  470. public function setMostpopular(?bool $mostpopular)
  471. {
  472.     $this->mostpopular $mostpopular;
  473.     return $this;
  474. }
  475. /**
  476. * Get url - url
  477. * @return string|null
  478. */
  479. public function getUrl(): ?string
  480. {
  481.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  482.         $preValue $this->preGetValue("url");
  483.         if ($preValue !== null) {
  484.             return $preValue;
  485.         }
  486.     }
  487.     $data $this->url;
  488.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  489.         return $data->getPlain();
  490.     }
  491.     return $data;
  492. }
  493. /**
  494. * Set url - url
  495. * @param string|null $url
  496. * @return \Pimcore\Model\DataObject\Resources
  497. */
  498. public function setUrl(?string $url)
  499. {
  500.     $this->url $url;
  501.     return $this;
  502. }
  503. /**
  504. * Get references_links - References Links
  505. * @return \Pimcore\Model\DataObject\Data\BlockElement[][]
  506. */
  507. public function getReferences_links(): ?array
  508. {
  509.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  510.         $preValue $this->preGetValue("references_links");
  511.         if ($preValue !== null) {
  512.             return $preValue;
  513.         }
  514.     }
  515.     $data $this->getClass()->getFieldDefinition("references_links")->preGetData($this);
  516.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  517.         return $data->getPlain();
  518.     }
  519.     return $data;
  520. }
  521. /**
  522. * Set references_links - References Links
  523. * @param \Pimcore\Model\DataObject\Data\BlockElement[][] $references_links
  524. * @return \Pimcore\Model\DataObject\Resources
  525. */
  526. public function setReferences_links(?array $references_links)
  527. {
  528.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Block $fd */
  529.     $fd $this->getClass()->getFieldDefinition("references_links");
  530.     $this->references_links $fd->preSetData($this$references_links);
  531.     return $this;
  532. }
  533. }