1 | <?php |
||
20 | class DocumentInstantiator implements InstantiatorInterface |
||
21 | { |
||
22 | /** |
||
23 | * @invisible |
||
24 | * @var ODMInterface |
||
25 | */ |
||
26 | private $odm; |
||
27 | |||
28 | /** |
||
29 | * Primary instantiation class. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $class = ''; |
||
34 | |||
35 | /** |
||
36 | * Normalized schema delivered by DocumentSchema. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $schema = []; |
||
41 | |||
42 | /** |
||
43 | * @param ODMInterface $odm |
||
44 | * @param string $class |
||
45 | * @param array $schema |
||
46 | */ |
||
47 | public function __construct(ODMInterface $odm, string $class, array $schema) |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | * |
||
57 | * @return CompositableInterface|DocumentEntity|Document |
||
58 | * |
||
59 | * @throws InstantionException |
||
60 | */ |
||
61 | public function instantiate($fields, bool $filter = true): CompositableInterface |
||
89 | |||
90 | /** |
||
91 | * Define document class using it's fieldset and definition. |
||
92 | * |
||
93 | * @param \ArrayAccess|array $fields |
||
94 | * |
||
95 | * @return string |
||
96 | * |
||
97 | * @throws DefinitionException |
||
98 | */ |
||
99 | protected function defineClass($fields) |
||
125 | } |