@@ 174-195 (lines=22) @@ | ||
171 | * @param mixed $key |
|
172 | * @return mixed |
|
173 | */ |
|
174 | public function getLeanMapperEntityProperty(LeanMapper\Entity $item, $key) |
|
175 | { |
|
176 | $properties = explode('.', $key); |
|
177 | $value = $item; |
|
178 | ||
179 | while ($property = array_shift($properties)) { |
|
180 | if (!isset($value->{$property})) { |
|
181 | if ($this->datagrid->strict_entity_property) { |
|
182 | throw new DataGridException(sprintf( |
|
183 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
184 | $value, str_replace('.', '->', $key) |
|
185 | )); |
|
186 | } |
|
187 | ||
188 | return null; |
|
189 | } |
|
190 | ||
191 | $value = $value->{$property}; |
|
192 | } |
|
193 | ||
194 | return $value; |
|
195 | } |
|
196 | ||
197 | ||
198 | /** |
|
@@ 204-225 (lines=22) @@ | ||
201 | * @param string $key |
|
202 | * @return mixed |
|
203 | */ |
|
204 | public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, $key) |
|
205 | { |
|
206 | $properties = explode('.', $key); |
|
207 | $value = $item; |
|
208 | ||
209 | while ($property = array_shift($properties)) { |
|
210 | if (!isset($value->{$property})) { |
|
211 | if ($this->datagrid->strict_entity_property) { |
|
212 | throw new DataGridException(sprintf( |
|
213 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
214 | $value, str_replace('.', '->', $key) |
|
215 | )); |
|
216 | } |
|
217 | ||
218 | return null; |
|
219 | } |
|
220 | ||
221 | $value = $value->{$property}; |
|
222 | } |
|
223 | ||
224 | return $value; |
|
225 | } |
|
226 | ||
227 | ||
228 | /** |