source/Spiral/ODM/ODM.php 1 location
|
@@ 300-311 (lines=12) @@
|
| 297 |
|
* @return array|string |
| 298 |
|
* @throws ODMException |
| 299 |
|
*/ |
| 300 |
|
public function schema($item) |
| 301 |
|
{ |
| 302 |
|
if (!isset($this->schema[$item])) { |
| 303 |
|
$this->updateSchema(); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
if (!isset($this->schema[$item])) { |
| 307 |
|
throw new ODMException("Undefined ODM schema item '{$item}'."); |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
return $this->schema[$item]; |
| 311 |
|
} |
| 312 |
|
|
| 313 |
|
/** |
| 314 |
|
* Get primary document class to be associated with collection. Attention, collection may return |
source/Spiral/ORM/ORM.php 1 location
|
@@ 266-277 (lines=12) @@
|
| 263 |
|
* @return array |
| 264 |
|
* @throws ORMException |
| 265 |
|
*/ |
| 266 |
|
public function schema($record) |
| 267 |
|
{ |
| 268 |
|
if (!isset($this->schema[$record])) { |
| 269 |
|
$this->updateSchema(); |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
if (!isset($this->schema[$record])) { |
| 273 |
|
throw new ORMException("Undefined ORM schema item, unknown record '{$record}'."); |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
return $this->schema[$record]; |
| 277 |
|
} |
| 278 |
|
|
| 279 |
|
/** |
| 280 |
|
* Create record relation instance by given relation type, parent and definition (options). |