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