|
@@ 70-85 (lines=16) @@
|
| 67 |
|
* @return RelationInterface |
| 68 |
|
* @throws ORMException |
| 69 |
|
*/ |
| 70 |
|
public function relation( |
| 71 |
|
$type, |
| 72 |
|
RecordInterface $parent, |
| 73 |
|
$definition, |
| 74 |
|
$data = null, |
| 75 |
|
$loaded = false |
| 76 |
|
) { |
| 77 |
|
if (!$this->config->hasRelation($type, 'class')) { |
| 78 |
|
throw new ORMException("Undefined relation type '{$type}'."); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
$class = $this->config->relationClass($type, 'class'); |
| 82 |
|
|
| 83 |
|
//For performance reasons class constructed without container |
| 84 |
|
return new $class($this, $parent, $definition, $data, $loaded); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
/** |
| 88 |
|
* Get instance of relation/selection loader based on relation type and definition. |
|
@@ 97-107 (lines=11) @@
|
| 94 |
|
* @return LoaderInterface |
| 95 |
|
* @throws ORMException |
| 96 |
|
*/ |
| 97 |
|
public function loader($type, $container, array $definition, Loader $parent = null) |
| 98 |
|
{ |
| 99 |
|
if (!$this->config->hasRelation($type, 'loader')) { |
| 100 |
|
throw new ORMException("Undefined relation loader '{$type}'."); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
$class = $this->config->relationClass($type, 'loader'); |
| 104 |
|
|
| 105 |
|
//For performance reasons class constructed without container |
| 106 |
|
return new $class($this, $container, $definition, $parent); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
/** |
| 110 |
|
* Update ORM records schema, synchronize declared and database schemas and return instance of |