|
@@ 212-230 (lines=19) @@
|
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
|
| 212 |
|
private function assignSpecForHasOne($name, $resultType, &$spec, $storeMethodName, $recurse) { |
| 213 |
|
$resultTypeInstance = \Injector::inst()->create($resultType); |
| 214 |
|
|
| 215 |
|
$resultTypeMapping = array(); |
| 216 |
|
|
| 217 |
|
// get the fields for the result type, but do not recurse |
| 218 |
|
if($recurse) { |
| 219 |
|
$resultTypeMapping = $resultTypeInstance->getElasticaFields($storeMethodName, false); |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
$resultTypeMapping['ID'] = array('type' => 'integer'); |
| 223 |
|
|
| 224 |
|
if($storeMethodName) { |
| 225 |
|
$resultTypeMapping['__method'] = $name; |
| 226 |
|
} |
| 227 |
|
$spec = array('properties' => $resultTypeMapping); |
| 228 |
|
// we now change the name to the result type, not the method name |
| 229 |
|
$name = $resultType; |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
|
| 233 |
|
private function assignSpecForManyRelationship($name, $resultType, &$spec, $storeMethodName, $recurse) { |
|
@@ 233-253 (lines=21) @@
|
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
|
| 233 |
|
private function assignSpecForManyRelationship($name, $resultType, &$spec, $storeMethodName, $recurse) { |
| 234 |
|
$resultTypeInstance = \Injector::inst()->create($resultType); |
| 235 |
|
$resultTypeMapping = array(); |
| 236 |
|
|
| 237 |
|
// get the fields for the result type, but do not recurse |
| 238 |
|
if($recurse) { |
| 239 |
|
$resultTypeMapping = $resultTypeInstance->getElasticaFields($storeMethodName, false); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
$resultTypeMapping['ID'] = array('type' => 'integer'); |
| 243 |
|
|
| 244 |
|
if($storeMethodName) { |
| 245 |
|
$resultTypeMapping['__method'] = $name; |
| 246 |
|
} |
| 247 |
|
|
| 248 |
|
$spec = array('properties' => $resultTypeMapping); |
| 249 |
|
|
| 250 |
|
|
| 251 |
|
// we now change the name to the result type, not the method name |
| 252 |
|
$name = $resultType; |
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
|
| 256 |
|
private function assignSpecForStandardFieldType($name, $class, &$spec) { |