| @@ 57-70 (lines=14) @@ | ||
| 54 | * @param ODM $odm |
|
| 55 | * @throws SourceException |
|
| 56 | */ |
|
| 57 | public function __construct($class = null, ODM $odm = null) |
|
| 58 | { |
|
| 59 | if (empty($class)) { |
|
| 60 | if (empty(static::DOCUMENT)) { |
|
| 61 | throw new SourceException("Unable to create source without associate class."); |
|
| 62 | } |
|
| 63 | ||
| 64 | $class = static::DOCUMENT; |
|
| 65 | } |
|
| 66 | ||
| 67 | $this->class = $class; |
|
| 68 | $this->odm = $this->saturate($odm, ODM::class); |
|
| 69 | $this->setSelector($this->odm->selector($this->class)); |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Create new DocumentEntity based on set of provided fields. |
|
| @@ 57-70 (lines=14) @@ | ||
| 54 | * @param ORM $orm |
|
| 55 | * @throws SourceException |
|
| 56 | */ |
|
| 57 | public function __construct($class = null, ORM $orm = null) |
|
| 58 | { |
|
| 59 | if (empty($class)) { |
|
| 60 | if (empty(static::RECORD)) { |
|
| 61 | throw new SourceException("Unable to create source without associate class."); |
|
| 62 | } |
|
| 63 | ||
| 64 | $class = static::RECORD; |
|
| 65 | } |
|
| 66 | ||
| 67 | $this->class = $class; |
|
| 68 | $this->orm = $this->saturate($orm, ORM::class); |
|
| 69 | $this->setSelector($this->orm->selector($this->class)); |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Create new Record based on set of provided fields. |
|