1 | <?php |
||
15 | class SchemaBuilder |
||
16 | { |
||
17 | /** |
||
18 | * @var MongoManager |
||
19 | */ |
||
20 | private $manager; |
||
21 | |||
22 | /** |
||
23 | * @var SchemaInterface[] |
||
24 | */ |
||
25 | private $schemas = []; |
||
26 | |||
27 | /** |
||
28 | * @param MongoManager $manager |
||
29 | */ |
||
30 | public function __construct(MongoManager $manager) |
||
34 | |||
35 | /** |
||
36 | * Add new model schema into pool. |
||
37 | * |
||
38 | * @param SchemaInterface $schema |
||
39 | * |
||
40 | * @return self|$this |
||
41 | */ |
||
42 | public function addSchema(SchemaInterface $schema): SchemaBuilder |
||
48 | |||
49 | /** |
||
50 | * @param string $class |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | public function hasSchema(string $class): bool |
||
58 | |||
59 | /** |
||
60 | * @param string $class |
||
61 | * |
||
62 | * @return SchemaInterface |
||
63 | * |
||
64 | * @throws SchemaException |
||
65 | */ |
||
66 | public function getSchema(string $class): SchemaInterface |
||
74 | |||
75 | /** |
||
76 | * All available document schemas. |
||
77 | * |
||
78 | * @return SchemaInterface[] |
||
79 | */ |
||
80 | public function getSchemas(): array |
||
84 | |||
85 | /** |
||
86 | * Pack declared schemas in a normalized form. |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function packSchema(): array |
||
114 | |||
115 | /** |
||
116 | * Create all declared indexes. |
||
117 | * |
||
118 | * @throws UnsupportedException |
||
119 | * @throws DriverException |
||
120 | */ |
||
121 | public function createIndexes() |
||
140 | } |