@@ 85-97 (lines=13) @@ | ||
82 | * @return object Object itself on success (for the method chaining support). |
|
83 | * @throws \Exception If object has no field with such name. |
|
84 | */ |
|
85 | public function setFieldValue($fieldName, $fieldValue) { |
|
86 | if (isset($this->fieldsAliases[$fieldName])) { |
|
87 | $fieldName = $this->fieldsAliases[$fieldName]; |
|
88 | } |
|
89 | ||
90 | if (array_key_exists($fieldName, $this->fieldsList)) { |
|
91 | $this->fieldsList[$fieldName] = $fieldValue; |
|
92 | ||
93 | return $this; |
|
94 | } else { |
|
95 | throw new \Exception("Object '" . get_class($this) . "' hasn't field '" . $fieldName . "'"); |
|
96 | } |
|
97 | } |
|
98 | ||
99 | /** |
|
100 | * Returns fields list array. |
|
@@ 134-144 (lines=11) @@ | ||
131 | * @return mixed |
|
132 | * @throws \Exception If object doesn't have this field or alias. |
|
133 | */ |
|
134 | public function getFieldValue($fieldName) { |
|
135 | if (isset($this->fieldsAliases[$fieldName])) { |
|
136 | $fieldName = $this->fieldsAliases[$fieldName]; |
|
137 | } |
|
138 | ||
139 | if (array_key_exists($fieldName, $this->fieldsList)) { |
|
140 | return stripslashes($this->fieldsList[$fieldName]); |
|
141 | } else { |
|
142 | throw new \Exception("Object '" . get_class($this) . "' hasn't field '" . $fieldName . "'"); |
|
143 | } |
|
144 | } |
|
145 | ||
146 | /** |
|
147 | * Returns type custed new empty field value. |