1 | <?php |
||
29 | class EntityManagerBuilder |
||
30 | { |
||
31 | /** |
||
32 | * Default configuration options. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected static $defaultOptions = [ |
||
37 | 'connection' => null, |
||
38 | 'cache_driver' => null, |
||
39 | 'annotation_files' => [], |
||
40 | 'annotation_namespaces' => [], |
||
41 | 'annotation_autoloaders' => [], |
||
42 | 'annotation_paths' => null, |
||
43 | 'xml_paths' => null, |
||
44 | 'yaml_paths' => null, |
||
45 | 'php_paths' => null, |
||
46 | 'naming_strategy' => null, |
||
47 | 'quote_strategy' => null, |
||
48 | 'proxy_path' => null, |
||
49 | 'proxies_namespace' => null, |
||
50 | 'auto_generate_proxies' => AbstractProxyFactory::AUTOGENERATE_NEVER, |
||
51 | 'sql_logger' => null, |
||
52 | 'event_manager' => null, |
||
53 | 'custom_types' => [], |
||
54 | 'string_functions' => [], |
||
55 | 'numeric_functions' => [], |
||
56 | 'datetime_functions' => [], |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * Create a Doctrine entity manager. |
||
61 | * |
||
62 | * @param array $options |
||
63 | * |
||
64 | * @throws \InvalidArgumentException |
||
65 | * |
||
66 | * @return \Doctrine\ORM\EntityManager |
||
67 | */ |
||
68 | public static function build(array $options) |
||
99 | |||
100 | /** |
||
101 | * Set up annotation metadata. |
||
102 | * |
||
103 | * @param array $options |
||
104 | */ |
||
105 | protected static function setupAnnotationMetadata(array $options) |
||
117 | |||
118 | /** |
||
119 | * Create Doctrine configuration. |
||
120 | * |
||
121 | * @param array $options |
||
122 | * |
||
123 | * @return \Doctrine\ORM\Configuration|null |
||
124 | */ |
||
125 | protected static function createConfiguration(array $options) |
||
168 | |||
169 | /** |
||
170 | * Normalize paths to array. |
||
171 | * |
||
172 | * @param array|string $paths |
||
173 | * |
||
174 | * @return array |
||
175 | */ |
||
176 | protected static function normalizePaths($paths) |
||
180 | |||
181 | /** |
||
182 | * Setup naming strategy. |
||
183 | * |
||
184 | * @param \Doctrine\ORM\Configuration $config |
||
185 | * @param array $options |
||
186 | * |
||
187 | * @throws \InvalidArgumentException |
||
188 | */ |
||
189 | protected static function setupNamingStrategy(Configuration &$config, array $options) |
||
198 | |||
199 | /** |
||
200 | * Setup quote strategy. |
||
201 | * |
||
202 | * @param \Doctrine\ORM\Configuration $config |
||
203 | * @param array $options |
||
204 | * |
||
205 | * @throws \InvalidArgumentException |
||
206 | */ |
||
207 | protected static function setupQuoteStrategy(Configuration &$config, array $options) |
||
216 | |||
217 | /** |
||
218 | * Setup proxies. |
||
219 | * |
||
220 | * @param \Doctrine\ORM\Configuration $config |
||
221 | * @param array $options |
||
222 | */ |
||
223 | protected static function setupProxy(Configuration &$config, array $options) |
||
230 | |||
231 | /** |
||
232 | * Setup SQL logger. |
||
233 | * |
||
234 | * @param \Doctrine\ORM\Configuration $config |
||
235 | * @param array $options |
||
236 | */ |
||
237 | protected static function setupSQLLogger(Configuration &$config, array $options) |
||
243 | |||
244 | /** |
||
245 | * Setup custom DQL functions. |
||
246 | * |
||
247 | * @param \Doctrine\ORM\Configuration $config |
||
248 | * @param array $options |
||
249 | */ |
||
250 | protected static function setupCustomDQLFunctions(Configuration &$config, array $options) |
||
258 | |||
259 | /** |
||
260 | * Setup Custom DBAL types. |
||
261 | * |
||
262 | * @param \Doctrine\DBAL\Connection $connection |
||
263 | * @param array $options |
||
264 | */ |
||
265 | protected static function setupCustomDBALTypes(Connection &$connection, array $options) |
||
272 | } |
||
273 |