var/classes/DataObject/Job.php line 118

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