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