| @@ 143-160 (lines=18) @@ | ||
| 140 | /** |
|
| 141 | * {@inheritdoc} |
|
| 142 | */ |
|
| 143 | public function define(string $class, int $property) |
|
| 144 | { |
|
| 145 | if (empty($this->schema)) { |
|
| 146 | //Update and remember |
|
| 147 | $this->setSchema($this->schemaBuilder(), true); |
|
| 148 | } |
|
| 149 | ||
| 150 | //Check value |
|
| 151 | if (!isset($this->schema[$class])) { |
|
| 152 | throw new ODMException("Undefined ODM schema item '{$class}', make sure schema is updated"); |
|
| 153 | } |
|
| 154 | ||
| 155 | if (!array_key_exists($property, $this->schema[$class])) { |
|
| 156 | throw new ODMException("Undefined ODM schema property '{$class}'.'{$property}'"); |
|
| 157 | } |
|
| 158 | ||
| 159 | return $this->schema[$class][$property]; |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * Get source (selection repository) for specific entity class. |
|
| @@ 134-151 (lines=18) @@ | ||
| 131 | /** |
|
| 132 | * {@inheritdoc} |
|
| 133 | */ |
|
| 134 | public function define(string $class, int $property) |
|
| 135 | { |
|
| 136 | if (empty($this->schema)) { |
|
| 137 | //Update and remember |
|
| 138 | $this->setSchema($this->schemaBuilder()->renderSchema(), true); |
|
| 139 | } |
|
| 140 | ||
| 141 | //Check value |
|
| 142 | if (!isset($this->schema[$class])) { |
|
| 143 | throw new ORMException("Undefined ORM schema item '{$class}', make sure schema is updated"); |
|
| 144 | } |
|
| 145 | ||
| 146 | if (!array_key_exists($property, $this->schema[$class])) { |
|
| 147 | throw new ORMException("Undefined ORM schema property '{$class}'.'{$property}'"); |
|
| 148 | } |
|
| 149 | ||
| 150 | return $this->schema[$class][$property]; |
|
| 151 | } |
|
| 152 | ||
| 153 | //other methods |
|
| 154 | ||