| @@ 141-162 (lines=22) @@ | ||
| 138 | * @param mixed $key |
|
| 139 | * @return mixed |
|
| 140 | */ |
|
| 141 | public function getLeanMapperEntityProperty(LeanMapper\Entity $item, $key) |
|
| 142 | { |
|
| 143 | $properties = explode('.', $key); |
|
| 144 | $value = $item; |
|
| 145 | ||
| 146 | while ($property = array_shift($properties)) { |
|
| 147 | if (!isset($value->{$property})) { |
|
| 148 | if ($this->datagrid->strict_entity_property) { |
|
| 149 | throw new DataGridException(sprintf( |
|
| 150 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
| 151 | $value, str_replace('.', '->', $key) |
|
| 152 | )); |
|
| 153 | } |
|
| 154 | ||
| 155 | return NULL; |
|
| 156 | } |
|
| 157 | ||
| 158 | $value = $value->{$property}; |
|
| 159 | } |
|
| 160 | ||
| 161 | return $value; |
|
| 162 | } |
|
| 163 | ||
| 164 | ||
| 165 | /** |
|
| @@ 171-192 (lines=22) @@ | ||
| 168 | * @param string $key |
|
| 169 | * @return mixed |
|
| 170 | */ |
|
| 171 | public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, $key) |
|
| 172 | { |
|
| 173 | $properties = explode('.', $key); |
|
| 174 | $value = $item; |
|
| 175 | ||
| 176 | while ($property = array_shift($properties)) { |
|
| 177 | if (!isset($value->{$property})) { |
|
| 178 | if ($this->datagrid->strict_entity_property) { |
|
| 179 | throw new DataGridException(sprintf( |
|
| 180 | 'Target Property [%s] is not an object or is empty, trying to get [%s]', |
|
| 181 | $value, str_replace('.', '->', $key) |
|
| 182 | )); |
|
| 183 | } |
|
| 184 | ||
| 185 | return NULL; |
|
| 186 | } |
|
| 187 | ||
| 188 | $value = $value->{$property}; |
|
| 189 | } |
|
| 190 | ||
| 191 | return $value; |
|
| 192 | } |
|
| 193 | ||
| 194 | ||
| 195 | /** |
|