var/classes/DataObject/Magazin.php line 27

Open in your IDE?
  1. <?php
  2. /**
  3. * Inheritance: no
  4. * Variants: no
  5. Fields Summary:
  6. - Image [image]
  7. - Link [link]
  8. - modal [checkbox]
  9. - video [manyToOneRelation]
  10. */
  11. namespace Pimcore\Model\DataObject;
  12. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  13. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  14. /**
  15. * @method static \Pimcore\Model\DataObject\Magazin\Listing getList(array $config = [])
  16. * @method static \Pimcore\Model\DataObject\Magazin\Listing|\Pimcore\Model\DataObject\Magazin|null getByImage($value, $limit = 0, $offset = 0, $objectTypes = null)
  17. * @method static \Pimcore\Model\DataObject\Magazin\Listing|\Pimcore\Model\DataObject\Magazin|null getByModal($value, $limit = 0, $offset = 0, $objectTypes = null)
  18. * @method static \Pimcore\Model\DataObject\Magazin\Listing|\Pimcore\Model\DataObject\Magazin|null getByVideo($value, $limit = 0, $offset = 0, $objectTypes = null)
  19. */
  20. class Magazin extends Concrete
  21. {
  22. protected $o_classId = "Magazin";
  23. protected $o_className = "Magazin";
  24. protected $Image;
  25. protected $Link;
  26. protected $modal;
  27. protected $video;
  28. /**
  29. * @param array $values
  30. * @return \Pimcore\Model\DataObject\Magazin
  31. */
  32. public static function create($values = array()) {
  33.     $object = new static();
  34.     $object->setValues($values);
  35.     return $object;
  36. }
  37. /**
  38. * Get Image - Image
  39. * @return \Pimcore\Model\Asset\Image|null
  40. */
  41. public function getImage(): ?\Pimcore\Model\Asset\Image
  42. {
  43.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  44.         $preValue = $this->preGetValue("Image");
  45.         if ($preValue !== null) {
  46.             return $preValue;
  47.         }
  48.     }
  49.     $data = $this->Image;
  50.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  51.         return $data->getPlain();
  52.     }
  53.     return $data;
  54. }
  55. /**
  56. * Set Image - Image
  57. * @param \Pimcore\Model\Asset\Image|null $Image
  58. * @return \Pimcore\Model\DataObject\Magazin
  59. */
  60. public function setImage(?\Pimcore\Model\Asset\Image $Image)
  61. {
  62.     $this->Image = $Image;
  63.     return $this;
  64. }
  65. /**
  66. * Get Link - Link
  67. * @return \Pimcore\Model\DataObject\Data\Link|null
  68. */
  69. public function getLink(): ?\Pimcore\Model\DataObject\Data\Link
  70. {
  71.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  72.         $preValue = $this->preGetValue("Link");
  73.         if ($preValue !== null) {
  74.             return $preValue;
  75.         }
  76.     }
  77.     $data = $this->Link;
  78.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  79.         return $data->getPlain();
  80.     }
  81.     return $data;
  82. }
  83. /**
  84. * Set Link - Link
  85. * @param \Pimcore\Model\DataObject\Data\Link|null $Link
  86. * @return \Pimcore\Model\DataObject\Magazin
  87. */
  88. public function setLink(?\Pimcore\Model\DataObject\Data\Link $Link)
  89. {
  90.     $this->Link = $Link;
  91.     return $this;
  92. }
  93. /**
  94. * Get modal - Modal
  95. * @return bool|null
  96. */
  97. public function getModal(): ?bool
  98. {
  99.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  100.         $preValue = $this->preGetValue("modal");
  101.         if ($preValue !== null) {
  102.             return $preValue;
  103.         }
  104.     }
  105.     $data = $this->modal;
  106.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  107.         return $data->getPlain();
  108.     }
  109.     return $data;
  110. }
  111. /**
  112. * Set modal - Modal
  113. * @param bool|null $modal
  114. * @return \Pimcore\Model\DataObject\Magazin
  115. */
  116. public function setModal(?bool $modal)
  117. {
  118.     $this->modal = $modal;
  119.     return $this;
  120. }
  121. /**
  122. * Get video - Video
  123. * @return \Pimcore\Model\Asset\Video|null
  124. */
  125. public function getVideo(): ?\Pimcore\Model\Element\AbstractElement
  126. {
  127.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  128.         $preValue = $this->preGetValue("video");
  129.         if ($preValue !== null) {
  130.             return $preValue;
  131.         }
  132.     }
  133.     $data = $this->getClass()->getFieldDefinition("video")->preGetData($this);
  134.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  135.         return $data->getPlain();
  136.     }
  137.     return $data;
  138. }
  139. /**
  140. * Set video - Video
  141. * @param \Pimcore\Model\Asset\Video $video
  142. * @return \Pimcore\Model\DataObject\Magazin
  143. */
  144. public function setVideo(?\Pimcore\Model\Element\AbstractElement $video)
  145. {
  146.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  147.     $fd = $this->getClass()->getFieldDefinition("video");
  148.     $hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  149.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  150.     $currentData = $this->getVideo();
  151.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  152.     $isEqual = $fd->isEqual($currentData, $video);
  153.     if (!$isEqual) {
  154.         $this->markFieldDirty("video", true);
  155.     }
  156.     $this->video = $fd->preSetData($this, $video);
  157.     return $this;
  158. }
  159. }