var/classes/DataObject/News.php line 43

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - date [datetime]
  8.  * - categories [manyToManyObjectRelation]
  9.  * - themen [manyToManyObjectRelation]
  10.  * - localizedfields [localizedfields]
  11.  * -- teasertitle [input]
  12.  * -- teasertext [input]
  13.  * -- headline [input]
  14.  * -- intro [wysiwyg]
  15.  * -- content [wysiwyg]
  16.  * - teaserImage [image]
  17.  * - moreContent [fieldcollections]
  18.  * - requiredPermissions [permissionManyToManyRelation]
  19.  * - allPermissionsRequired [booleanSelect]
  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\News\Listing getList(array $config = [])
  26. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByDate($value, $limit = 0, $offset = 0, $objectTypes = null)
  27. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByCategories($value, $limit = 0, $offset = 0, $objectTypes = null)
  28. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByThemen($value, $limit = 0, $offset = 0, $objectTypes = null)
  29. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  30. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByTeasertitle($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  31. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByTeasertext($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  32. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByHeadline($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  33. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByIntro($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  34. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByContent($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  35. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByTeaserImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  36. * @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByRequiredPermissions($value, $limit = 0, $offset = 0, $objectTypes = null)
  37. */
  38. class News extends Concrete
  39. {
  40. protected $o_classId "8";
  41. protected $o_className "News";
  42. protected $date;
  43. protected $categories;
  44. protected $themen;
  45. protected $localizedfields;
  46. protected $teaserImage;
  47. protected $moreContent;
  48. protected $requiredPermissions;
  49. protected $allPermissionsRequired;
  50. /**
  51. * @param array $values
  52. * @return \Pimcore\Model\DataObject\News
  53. */
  54. public static function create($values = array()) {
  55.     $object = new static();
  56.     $object->setValues($values);
  57.     return $object;
  58. }
  59. /**
  60. * Get date - Date
  61. * @return \Carbon\Carbon|null
  62. */
  63. public function getDate()
  64. {
  65.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  66.         $preValue $this->preGetValue("date");
  67.         if ($preValue !== null) {
  68.             return $preValue;
  69.         }
  70.     }
  71.     $data $this->date;
  72.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  73.         return $data->getPlain();
  74.     }
  75.     return $data;
  76. }
  77. /**
  78. * Set date - Date
  79. * @param \Carbon\Carbon|null $date
  80. * @return \Pimcore\Model\DataObject\News
  81. */
  82. public function setDate($date)
  83. {
  84.     $this->date $date;
  85.     return $this;
  86. }
  87. /**
  88. * Get categories - Categories
  89. * @return \Pimcore\Model\DataObject\Category[]
  90. */
  91. public function getCategories()
  92. {
  93.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  94.         $preValue $this->preGetValue("categories");
  95.         if ($preValue !== null) {
  96.             return $preValue;
  97.         }
  98.     }
  99.     $data $this->getClass()->getFieldDefinition("categories")->preGetData($this);
  100.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  101.         return $data->getPlain();
  102.     }
  103.     return $data;
  104. }
  105. /**
  106. * Set categories - Categories
  107. * @param \Pimcore\Model\DataObject\Category[] $categories
  108. * @return \Pimcore\Model\DataObject\News
  109. */
  110. public function setCategories($categories)
  111. {
  112.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  113.     $fd $this->getClass()->getFieldDefinition("categories");
  114.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  115.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  116.     $currentData $this->getCategories();
  117.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  118.     $isEqual $fd->isEqual($currentData$categories);
  119.     if (!$isEqual) {
  120.         $this->markFieldDirty("categories"true);
  121.     }
  122.     $this->categories $fd->preSetData($this$categories);
  123.     return $this;
  124. }
  125. /**
  126. * Get themen - Topics
  127. * @return \Pimcore\Model\DataObject\Themen[]
  128. */
  129. public function getThemen()
  130. {
  131.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  132.         $preValue $this->preGetValue("themen");
  133.         if ($preValue !== null) {
  134.             return $preValue;
  135.         }
  136.     }
  137.     $data $this->getClass()->getFieldDefinition("themen")->preGetData($this);
  138.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  139.         return $data->getPlain();
  140.     }
  141.     return $data;
  142. }
  143. /**
  144. * Set themen - Topics
  145. * @param \Pimcore\Model\DataObject\Themen[] $themen
  146. * @return \Pimcore\Model\DataObject\News
  147. */
  148. public function setThemen($themen)
  149. {
  150.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyObjectRelation $fd */
  151.     $fd $this->getClass()->getFieldDefinition("themen");
  152.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  153.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  154.     $currentData $this->getThemen();
  155.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  156.     $isEqual $fd->isEqual($currentData$themen);
  157.     if (!$isEqual) {
  158.         $this->markFieldDirty("themen"true);
  159.     }
  160.     $this->themen $fd->preSetData($this$themen);
  161.     return $this;
  162. }
  163. /**
  164. * Get localizedfields - 
  165. * @return \Pimcore\Model\DataObject\Localizedfield|null
  166. */
  167. public function getLocalizedfields()
  168. {
  169.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  170.         $preValue $this->preGetValue("localizedfields");
  171.         if ($preValue !== null) {
  172.             return $preValue;
  173.         }
  174.     }
  175.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  176.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  177.         return $data->getPlain();
  178.     }
  179.     return $data;
  180. }
  181. /**
  182. * Get teasertitle - Title (approx. 65 chars)
  183. * @return string|null
  184. */
  185. public function getTeasertitle($language null)
  186. {
  187.     $data $this->getLocalizedfields()->getLocalizedValue("teasertitle"$language);
  188.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  189.         $preValue $this->preGetValue("teasertitle");
  190.         if ($preValue !== null) {
  191.             return $preValue;
  192.         }
  193.     }
  194.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  195.         return $data->getPlain();
  196.     }
  197.     return $data;
  198. }
  199. /**
  200. * Get teasertext - Text (max. 230 chars)
  201. * @return string|null
  202. */
  203. public function getTeasertext($language null)
  204. {
  205.     $data $this->getLocalizedfields()->getLocalizedValue("teasertext"$language);
  206.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  207.         $preValue $this->preGetValue("teasertext");
  208.         if ($preValue !== null) {
  209.             return $preValue;
  210.         }
  211.     }
  212.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  213.         return $data->getPlain();
  214.     }
  215.     return $data;
  216. }
  217. /**
  218. * Get headline - Headline
  219. * @return string|null
  220. */
  221. public function getHeadline($language null)
  222. {
  223.     $data $this->getLocalizedfields()->getLocalizedValue("headline"$language);
  224.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  225.         $preValue $this->preGetValue("headline");
  226.         if ($preValue !== null) {
  227.             return $preValue;
  228.         }
  229.     }
  230.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  231.         return $data->getPlain();
  232.     }
  233.     return $data;
  234. }
  235. /**
  236. * Get intro - Intro (bold)
  237. * @return string|null
  238. */
  239. public function getIntro($language null)
  240. {
  241.     $data $this->getLocalizedfields()->getLocalizedValue("intro"$language);
  242.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  243.         $preValue $this->preGetValue("intro");
  244.         if ($preValue !== null) {
  245.             return $preValue;
  246.         }
  247.     }
  248.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  249.         return $data->getPlain();
  250.     }
  251.     return $data;
  252. }
  253. /**
  254. * Get content - Content text
  255. * @return string|null
  256. */
  257. public function getContent($language null)
  258. {
  259.     $data $this->getLocalizedfields()->getLocalizedValue("content"$language);
  260.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  261.         $preValue $this->preGetValue("content");
  262.         if ($preValue !== null) {
  263.             return $preValue;
  264.         }
  265.     }
  266.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  267.         return $data->getPlain();
  268.     }
  269.     return $data;
  270. }
  271. /**
  272. * Set localizedfields - 
  273. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  274. * @return \Pimcore\Model\DataObject\News
  275. */
  276. public function setLocalizedfields($localizedfields)
  277. {
  278.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  279.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  280.     $currentData $this->getLocalizedfields();
  281.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  282.     $this->markFieldDirty("localizedfields"true);
  283.     $this->localizedfields $localizedfields;
  284.     return $this;
  285. }
  286. /**
  287. * Set teasertitle - Title (approx. 65 chars)
  288. * @param string|null $teasertitle
  289. * @return \Pimcore\Model\DataObject\News
  290. */
  291. public function setTeasertitle ($teasertitle$language null)
  292. {
  293.     $isEqual false;
  294.     $this->getLocalizedfields()->setLocalizedValue("teasertitle"$teasertitle$language, !$isEqual);
  295.     return $this;
  296. }
  297. /**
  298. * Set teasertext - Text (max. 230 chars)
  299. * @param string|null $teasertext
  300. * @return \Pimcore\Model\DataObject\News
  301. */
  302. public function setTeasertext ($teasertext$language null)
  303. {
  304.     $isEqual false;
  305.     $this->getLocalizedfields()->setLocalizedValue("teasertext"$teasertext$language, !$isEqual);
  306.     return $this;
  307. }
  308. /**
  309. * Set headline - Headline
  310. * @param string|null $headline
  311. * @return \Pimcore\Model\DataObject\News
  312. */
  313. public function setHeadline ($headline$language null)
  314. {
  315.     $isEqual false;
  316.     $this->getLocalizedfields()->setLocalizedValue("headline"$headline$language, !$isEqual);
  317.     return $this;
  318. }
  319. /**
  320. * Set intro - Intro (bold)
  321. * @param string|null $intro
  322. * @return \Pimcore\Model\DataObject\News
  323. */
  324. public function setIntro ($intro$language null)
  325. {
  326.     $isEqual false;
  327.     $this->getLocalizedfields()->setLocalizedValue("intro"$intro$language, !$isEqual);
  328.     return $this;
  329. }
  330. /**
  331. * Set content - Content text
  332. * @param string|null $content
  333. * @return \Pimcore\Model\DataObject\News
  334. */
  335. public function setContent ($content$language null)
  336. {
  337.     $isEqual false;
  338.     $this->getLocalizedfields()->setLocalizedValue("content"$content$language, !$isEqual);
  339.     return $this;
  340. }
  341. /**
  342. * Get teaserImage - Teaser Image
  343. * @return \Pimcore\Model\Asset\Image|null
  344. */
  345. public function getTeaserImage()
  346. {
  347.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  348.         $preValue $this->preGetValue("teaserImage");
  349.         if ($preValue !== null) {
  350.             return $preValue;
  351.         }
  352.     }
  353.     $data $this->teaserImage;
  354.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  355.         return $data->getPlain();
  356.     }
  357.     return $data;
  358. }
  359. /**
  360. * Set teaserImage - Teaser Image
  361. * @param \Pimcore\Model\Asset\Image|null $teaserImage
  362. * @return \Pimcore\Model\DataObject\News
  363. */
  364. public function setTeaserImage($teaserImage)
  365. {
  366.     $this->teaserImage $teaserImage;
  367.     return $this;
  368. }
  369. /**
  370. * @return \Pimcore\Model\DataObject\Fieldcollection|null
  371. */
  372. public function getMoreContent(): ?\Pimcore\Model\DataObject\Fieldcollection
  373. {
  374.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  375.         $preValue $this->preGetValue("moreContent");
  376.         if ($preValue !== null) {
  377.             return $preValue;
  378.         }
  379.     }
  380.     $data $this->getClass()->getFieldDefinition("moreContent")->preGetData($this);
  381.     return $data;
  382. }
  383. /**
  384. * Set moreContent - More Content
  385. * @param \Pimcore\Model\DataObject\Fieldcollection|null $moreContent
  386. * @return \Pimcore\Model\DataObject\News
  387. */
  388. public function setMoreContent($moreContent)
  389. {
  390.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections $fd */
  391.     $fd $this->getClass()->getFieldDefinition("moreContent");
  392.     $this->moreContent $fd->preSetData($this$moreContent);
  393.     return $this;
  394. }
  395. /**
  396. * Get requiredPermissions - Required Permissions
  397. * @return \Pimcore\Model\DataObject\Role[]
  398. */
  399. public function getRequiredPermissions()
  400. {
  401.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  402.         $preValue $this->preGetValue("requiredPermissions");
  403.         if ($preValue !== null) {
  404.             return $preValue;
  405.         }
  406.     }
  407.     $data $this->getClass()->getFieldDefinition("requiredPermissions")->preGetData($this);
  408.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  409.         return $data->getPlain();
  410.     }
  411.     return $data;
  412. }
  413. /**
  414. * Set requiredPermissions - Required Permissions
  415. * @param \Pimcore\Model\DataObject\Role[] $requiredPermissions
  416. * @return \Pimcore\Model\DataObject\News
  417. */
  418. public function setRequiredPermissions($requiredPermissions)
  419. {
  420.     /** @var \FrontendPermissionToolkitBundle\CoreExtensions\ClassDefinitions\PermissionManyToManyRelation $fd */
  421.     $fd $this->getClass()->getFieldDefinition("requiredPermissions");
  422.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  423.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  424.     $currentData $this->getRequiredPermissions();
  425.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  426.     $isEqual $fd->isEqual($currentData$requiredPermissions);
  427.     if (!$isEqual) {
  428.         $this->markFieldDirty("requiredPermissions"true);
  429.     }
  430.     $this->requiredPermissions $fd->preSetData($this$requiredPermissions);
  431.     return $this;
  432. }
  433. /**
  434. * Get allPermissionsRequired - All Permissions Required
  435. * @return bool|null
  436. */
  437. public function getAllPermissionsRequired()
  438. {
  439.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  440.         $preValue $this->preGetValue("allPermissionsRequired");
  441.         if ($preValue !== null) {
  442.             return $preValue;
  443.         }
  444.     }
  445.     $data $this->allPermissionsRequired;
  446.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  447.         return $data->getPlain();
  448.     }
  449.     return $data;
  450. }
  451. /**
  452. * Set allPermissionsRequired - All Permissions Required
  453. * @param bool|null $allPermissionsRequired
  454. * @return \Pimcore\Model\DataObject\News
  455. */
  456. public function setAllPermissionsRequired($allPermissionsRequired)
  457. {
  458.     $this->allPermissionsRequired $allPermissionsRequired;
  459.     return $this;
  460. }
  461. }