1 | <?php |
||
24 | class DocumentManagerBuilder |
||
25 | { |
||
26 | use ObjectManagerTrait; |
||
27 | |||
28 | /** |
||
29 | * Default configuration options. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected static $defaultOptions = [ |
||
34 | 'connection' => null, |
||
35 | 'cache_driver' => null, |
||
36 | 'cache_namespace' => null, |
||
37 | 'annotation_files' => [], |
||
38 | 'annotation_namespaces' => [], |
||
39 | 'annotation_autoloaders' => [], |
||
40 | 'annotation_paths' => null, |
||
41 | 'xml_paths' => null, |
||
42 | 'yaml_paths' => null, |
||
43 | 'php_paths' => null, |
||
44 | 'default_database' => null, |
||
45 | 'proxy_path' => null, |
||
46 | 'proxies_namespace' => 'DoctrineODMProxy', |
||
47 | 'auto_generate_proxies' => AbstractProxyFactory::AUTOGENERATE_NEVER, |
||
48 | 'hydrator_path' => null, |
||
49 | 'hydrators_namespace' => 'DoctrineODMHydrator', |
||
50 | 'auto_generate_hydrators' => AbstractProxyFactory::AUTOGENERATE_NEVER, |
||
51 | 'logger_callable' => null, |
||
52 | 'event_manager' => null, |
||
53 | ]; |
||
54 | |||
55 | /** |
||
56 | * Create a Doctrine document manager. |
||
57 | * |
||
58 | * @param array $options |
||
59 | * |
||
60 | * @throws \InvalidArgumentException |
||
61 | * @throws \RuntimeException |
||
62 | * |
||
63 | * @return \Doctrine\ODM\MongoDB\DocumentManager |
||
64 | */ |
||
65 | public static function build(array $options) |
||
85 | |||
86 | /** |
||
87 | * Create Doctrine ODM bare configuration. |
||
88 | * |
||
89 | * @param array $options |
||
90 | * |
||
91 | * @throws \InvalidArgumentException |
||
92 | * |
||
93 | * @return \Doctrine\ODM\MongoDB\Configuration |
||
94 | */ |
||
95 | protected static function getConfiguration(array $options) |
||
107 | |||
108 | /** |
||
109 | * Create Doctrine ODM configuration. |
||
110 | * |
||
111 | * @param \Doctrine\ODM\MongoDB\Configuration $config |
||
112 | * @param array $options |
||
113 | * |
||
114 | * @throws \RuntimeException |
||
115 | */ |
||
116 | protected static function setupMetadataDriver(Configuration $config, array $options) |
||
146 | |||
147 | /** |
||
148 | * Setup default database. |
||
149 | * |
||
150 | * @param \Doctrine\ODM\MongoDB\Configuration $config |
||
151 | * @param array $options |
||
152 | */ |
||
153 | protected static function setupDefaultDatabase(Configuration $config, array $options) |
||
159 | |||
160 | /** |
||
161 | * Setup hydrators. |
||
162 | * |
||
163 | * @param \Doctrine\ODM\MongoDB\Configuration $config |
||
164 | * @param array $options |
||
165 | */ |
||
166 | protected static function setupHydrator(Configuration $config, array $options) |
||
174 | |||
175 | /** |
||
176 | * Setup logger. |
||
177 | * |
||
178 | * @param \Doctrine\ODM\MongoDB\Configuration $config |
||
179 | * @param array $options |
||
180 | */ |
||
181 | protected static function setupLogger(Configuration $config, array $options) |
||
187 | |||
188 | /** |
||
189 | * Create MongoDB Connection. |
||
190 | * |
||
191 | * @param \Doctrine\ODM\MongoDB\Configuration $config |
||
192 | * @param array $options |
||
193 | * |
||
194 | * @throws \InvalidArgumentException |
||
195 | * @throws \RuntimeException |
||
196 | * |
||
197 | * @return \Doctrine\MongoDB\Connection |
||
198 | */ |
||
199 | protected static function getConnection(Configuration $config, array $options) |
||
229 | } |
||
230 |