1 | <?php |
||
25 | class ORM extends Component implements ORMInterface, SingletonInterface |
||
26 | { |
||
27 | /** |
||
28 | * Memory section to store ORM schema. |
||
29 | */ |
||
30 | const MEMORY = 'orm.schema'; |
||
31 | |||
32 | /** |
||
33 | * Already created instantiators. |
||
34 | * |
||
35 | * @invisible |
||
36 | * @var InstantiatorInterface[] |
||
37 | */ |
||
38 | private $instantiators = []; |
||
39 | |||
40 | /** |
||
41 | * ORM schema. |
||
42 | * |
||
43 | * @invisible |
||
44 | * @var array |
||
45 | */ |
||
46 | private $schema = []; |
||
47 | |||
48 | /** |
||
49 | * @var DatabaseManager |
||
50 | */ |
||
51 | protected $manager; |
||
52 | |||
53 | /** |
||
54 | * @var SchemaLocator |
||
55 | */ |
||
56 | protected $locator; |
||
57 | |||
58 | /** |
||
59 | * @invisible |
||
60 | * @var MemoryInterface |
||
61 | */ |
||
62 | protected $memory; |
||
63 | |||
64 | /** |
||
65 | * Container defines working scope for all Documents and DocumentEntities. |
||
66 | * |
||
67 | * @var ContainerInterface |
||
68 | */ |
||
69 | protected $container; |
||
70 | |||
71 | /** |
||
72 | * @param DatabaseManager $manager |
||
73 | * @param LocatorInterface $locator |
||
74 | * @param MemoryInterface $memory |
||
75 | * @param ContainerInterface $container |
||
76 | */ |
||
77 | public function __construct( |
||
92 | |||
93 | /** |
||
94 | * Create instance of ORM SchemaBuilder. |
||
95 | * |
||
96 | * @param bool $locate Set to true to automatically locate available records and record sources |
||
97 | * sources in a project files (based on tokenizer scope). |
||
98 | * |
||
99 | * @return SchemaBuilder |
||
100 | * |
||
101 | * @throws SchemaException |
||
102 | */ |
||
103 | public function schemaBuilder(bool $locate = true): SchemaBuilder |
||
122 | |||
123 | /** |
||
124 | * Specify behaviour schema for ORM to be used. |
||
125 | * |
||
126 | * @param SchemaBuilder $builder |
||
127 | * @param bool $remember Set to true to remember packed schema in memory. |
||
128 | */ |
||
129 | public function setSchema(SchemaBuilder $builder, bool $remember = false) |
||
137 | |||
138 | /** |
||
139 | * {@inheritdoc} |
||
140 | */ |
||
141 | public function define(string $class, int $property) |
||
159 | |||
160 | //other methods |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function make( |
||
174 | |||
175 | //todo: __clone |
||
176 | |||
177 | /** |
||
178 | * Get object responsible for class instantiation. |
||
179 | * |
||
180 | * @param string $class |
||
181 | * |
||
182 | * @return InstantiatorInterface |
||
183 | */ |
||
184 | protected function instantiator(string $class): InstantiatorInterface |
||
203 | |||
204 | /** |
||
205 | * Load packed schema from memory. |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | protected function loadSchema(): array |
||
213 | |||
214 | /** |
||
215 | * Get ODM specific factory. |
||
216 | * |
||
217 | * @return FactoryInterface |
||
218 | */ |
||
219 | protected function getFactory(): FactoryInterface |
||
227 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..