var/classes/DataObject/Weather.php line 28

Open in your IDE?
  1. <?php
  2. /**
  3.  * Inheritance: no
  4.  * Variants: no
  5.  *
  6.  * Fields Summary:
  7.  * - infosnowId [input]
  8.  * - localizedfields [localizedfields]
  9.  * -- name [input]
  10.  * - forecasts [fieldcollections]
  11.  * - area [manyToOneRelation]
  12.  */
  13. namespace Pimcore\Model\DataObject;
  14. use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
  15. use Pimcore\Model\DataObject\PreGetValueHookInterface;
  16. /**
  17. * @method static \Pimcore\Model\DataObject\Weather\Listing getList(array $config = [])
  18. * @method static \Pimcore\Model\DataObject\Weather\Listing|\Pimcore\Model\DataObject\Weather|null getByInfosnowId($value, $limit = 0, $offset = 0, $objectTypes = null)
  19. * @method static \Pimcore\Model\DataObject\Weather\Listing|\Pimcore\Model\DataObject\Weather|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  20. * @method static \Pimcore\Model\DataObject\Weather\Listing|\Pimcore\Model\DataObject\Weather|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
  21. * @method static \Pimcore\Model\DataObject\Weather\Listing|\Pimcore\Model\DataObject\Weather|null getByArea($value, $limit = 0, $offset = 0, $objectTypes = null)
  22. */
  23. class Weather extends Concrete
  24. {
  25. protected $o_classId "Weather";
  26. protected $o_className "Weather";
  27. protected $infosnowId;
  28. protected $localizedfields;
  29. protected $forecasts;
  30. protected $area;
  31. /**
  32. * @param array $values
  33. * @return \Pimcore\Model\DataObject\Weather
  34. */
  35. public static function create($values = array()) {
  36.     $object = new static();
  37.     $object->setValues($values);
  38.     return $object;
  39. }
  40. /**
  41. * Get infosnowId - Infosnow Id
  42. * @return string|null
  43. */
  44. public function getInfosnowId(): ?string
  45. {
  46.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  47.         $preValue $this->preGetValue("infosnowId");
  48.         if ($preValue !== null) {
  49.             return $preValue;
  50.         }
  51.     }
  52.     $data $this->infosnowId;
  53.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  54.         return $data->getPlain();
  55.     }
  56.     return $data;
  57. }
  58. /**
  59. * Set infosnowId - Infosnow Id
  60. * @param string|null $infosnowId
  61. * @return \Pimcore\Model\DataObject\Weather
  62. */
  63. public function setInfosnowId(?string $infosnowId)
  64. {
  65.     $this->infosnowId $infosnowId;
  66.     return $this;
  67. }
  68. /**
  69. * Get localizedfields - 
  70. * @return \Pimcore\Model\DataObject\Localizedfield|null
  71. */
  72. public function getLocalizedfields(): ?\Pimcore\Model\DataObject\Localizedfield
  73. {
  74.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  75.         $preValue $this->preGetValue("localizedfields");
  76.         if ($preValue !== null) {
  77.             return $preValue;
  78.         }
  79.     }
  80.     $data $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
  81.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  82.         return $data->getPlain();
  83.     }
  84.     return $data;
  85. }
  86. /**
  87. * Get name - Name
  88. * @return string|null
  89. */
  90. public function getName($language null): ?string
  91. {
  92.     $data $this->getLocalizedfields()->getLocalizedValue("name"$language);
  93.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  94.         $preValue $this->preGetValue("name");
  95.         if ($preValue !== null) {
  96.             return $preValue;
  97.         }
  98.     }
  99.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  100.         return $data->getPlain();
  101.     }
  102.     return $data;
  103. }
  104. /**
  105. * Set localizedfields - 
  106. * @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
  107. * @return \Pimcore\Model\DataObject\Weather
  108. */
  109. public function setLocalizedfields(?\Pimcore\Model\DataObject\Localizedfield $localizedfields)
  110. {
  111.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  112.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  113.     $currentData $this->getLocalizedfields();
  114.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  115.     $this->markFieldDirty("localizedfields"true);
  116.     $this->localizedfields $localizedfields;
  117.     return $this;
  118. }
  119. /**
  120. * Set name - Name
  121. * @param string|null $name
  122. * @return \Pimcore\Model\DataObject\Weather
  123. */
  124. public function setName (?string $name$language null)
  125. {
  126.     $isEqual false;
  127.     $this->getLocalizedfields()->setLocalizedValue("name"$name$language, !$isEqual);
  128.     return $this;
  129. }
  130. /**
  131. * @return \Pimcore\Model\DataObject\Fieldcollection|null
  132. */
  133. public function getForecasts(): ?\Pimcore\Model\DataObject\Fieldcollection
  134. {
  135.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  136.         $preValue $this->preGetValue("forecasts");
  137.         if ($preValue !== null) {
  138.             return $preValue;
  139.         }
  140.     }
  141.     $data $this->getClass()->getFieldDefinition("forecasts")->preGetData($this);
  142.     return $data;
  143. }
  144. /**
  145. * Set forecasts - Forecasts
  146. * @param \Pimcore\Model\DataObject\Fieldcollection|null $forecasts
  147. * @return \Pimcore\Model\DataObject\Weather
  148. */
  149. public function setForecasts(?\Pimcore\Model\DataObject\Fieldcollection $forecasts)
  150. {
  151.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections $fd */
  152.     $fd $this->getClass()->getFieldDefinition("forecasts");
  153.     $this->forecasts $fd->preSetData($this$forecasts);
  154.     return $this;
  155. }
  156. /**
  157. * Get area - Skiing Area
  158. * @return \Pimcore\Model\DataObject\Resort|null
  159. */
  160. public function getArea(): ?\Pimcore\Model\Element\AbstractElement
  161. {
  162.     if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
  163.         $preValue $this->preGetValue("area");
  164.         if ($preValue !== null) {
  165.             return $preValue;
  166.         }
  167.     }
  168.     $data $this->getClass()->getFieldDefinition("area")->preGetData($this);
  169.     if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
  170.         return $data->getPlain();
  171.     }
  172.     return $data;
  173. }
  174. /**
  175. * Set area - Skiing Area
  176. * @param \Pimcore\Model\DataObject\Resort|null $area
  177. * @return \Pimcore\Model\DataObject\Weather
  178. */
  179. public function setArea(?\Pimcore\Model\Element\AbstractElement $area)
  180. {
  181.     /** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
  182.     $fd $this->getClass()->getFieldDefinition("area");
  183.     $hideUnpublished \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
  184.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
  185.     $currentData $this->getArea();
  186.     \Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
  187.     $isEqual $fd->isEqual($currentData$area);
  188.     if (!$isEqual) {
  189.         $this->markFieldDirty("area"true);
  190.     }
  191.     $this->area $fd->preSetData($this$area);
  192.     return $this;
  193. }
  194. }