| @@ 154-175 (lines=22) @@ | ||
| 151 | * @param mixed $key |
|
| 152 | * @return mixed |
|
| 153 | */ |
|
| 154 | public function getLeanMapperEntityProperty(LeanMapper\Entity $item, $key) |
|
| 155 | { |
|
| 156 | $properties = explode('.', $key); |
|
| 157 | $value = $item; |
|
| 158 | ||
| 159 | while ($property = array_shift($properties)) { |
|
| 160 | if (!isset($value->{$property})) { |
|
| 161 | if ($this->datagrid->strict_entity_property) { |
|
| 162 | throw new DataGridException(sprintf( |
|
| 163 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
| 164 | $value, str_replace('.', '->', $key) |
|
| 165 | )); |
|
| 166 | } |
|
| 167 | ||
| 168 | return NULL; |
|
| 169 | } |
|
| 170 | ||
| 171 | $value = $value->{$property}; |
|
| 172 | } |
|
| 173 | ||
| 174 | return $value; |
|
| 175 | } |
|
| 176 | ||
| 177 | ||
| 178 | /** |
|
| @@ 184-205 (lines=22) @@ | ||
| 181 | * @param string $key |
|
| 182 | * @return mixed |
|
| 183 | */ |
|
| 184 | public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, $key) |
|
| 185 | { |
|
| 186 | $properties = explode('.', $key); |
|
| 187 | $value = $item; |
|
| 188 | ||
| 189 | while ($property = array_shift($properties)) { |
|
| 190 | if (!isset($value->{$property})) { |
|
| 191 | if ($this->datagrid->strict_entity_property) { |
|
| 192 | throw new DataGridException(sprintf( |
|
| 193 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
| 194 | $value, str_replace('.', '->', $key) |
|
| 195 | )); |
|
| 196 | } |
|
| 197 | ||
| 198 | return NULL; |
|
| 199 | } |
|
| 200 | ||
| 201 | $value = $value->{$property}; |
|
| 202 | } |
|
| 203 | ||
| 204 | return $value; |
|
| 205 | } |
|
| 206 | ||
| 207 | ||
| 208 | /** |
|