|
@@ 290-305 (lines=16) @@
|
| 287 |
|
* @return RelationInterface |
| 288 |
|
* @throws ORMException |
| 289 |
|
*/ |
| 290 |
|
public function relation( |
| 291 |
|
$type, |
| 292 |
|
RecordInterface $parent, |
| 293 |
|
$definition, |
| 294 |
|
$data = null, |
| 295 |
|
$loaded = false |
| 296 |
|
) { |
| 297 |
|
if (!$this->config->hasRelation($type, 'class')) { |
| 298 |
|
throw new ORMException("Undefined relation type '{$type}'."); |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
$class = $this->config->relationClass($type, 'class'); |
| 302 |
|
|
| 303 |
|
//For performance reasons class constructed without container |
| 304 |
|
return new $class($this, $parent, $definition, $data, $loaded); |
| 305 |
|
} |
| 306 |
|
|
| 307 |
|
/** |
| 308 |
|
* Get instance of relation/selection loader based on relation type and definition. |
|
@@ 317-327 (lines=11) @@
|
| 314 |
|
* @return LoaderInterface |
| 315 |
|
* @throws ORMException |
| 316 |
|
*/ |
| 317 |
|
public function loader($type, $container, array $definition, Loader $parent = null) |
| 318 |
|
{ |
| 319 |
|
if (!$this->config->hasRelation($type, 'loader')) { |
| 320 |
|
throw new ORMException("Undefined relation loader '{$type}'."); |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
$class = $this->config->relationClass($type, 'loader'); |
| 324 |
|
|
| 325 |
|
//For performance reasons class constructed without container |
| 326 |
|
return new $class($this, $container, $definition, $parent); |
| 327 |
|
} |
| 328 |
|
|
| 329 |
|
/** |
| 330 |
|
* Update ORM records schema, synchronize declared and database schemas and return instance of |