1 | <?php |
||
28 | class EntityManagerBuilder |
||
29 | { |
||
30 | use ObjectManagerTrait; |
||
31 | |||
32 | /** |
||
33 | * Default configuration options. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected static $defaultOptions = [ |
||
38 | 'connection' => null, |
||
39 | 'cache_driver' => null, |
||
40 | 'cache_namespace' => null, |
||
41 | 'annotation_files' => [], |
||
42 | 'annotation_namespaces' => [], |
||
43 | 'annotation_autoloaders' => [], |
||
44 | 'annotation_paths' => null, |
||
45 | 'xml_paths' => null, |
||
46 | 'yaml_paths' => null, |
||
47 | 'php_paths' => null, |
||
48 | 'naming_strategy' => null, |
||
49 | 'quote_strategy' => null, |
||
50 | 'proxy_path' => null, |
||
51 | 'proxies_namespace' => 'DoctrineORMProxy', |
||
52 | 'auto_generate_proxies' => AbstractProxyFactory::AUTOGENERATE_NEVER, |
||
53 | 'sql_logger' => null, |
||
54 | 'event_manager' => null, |
||
55 | 'custom_types' => [], |
||
56 | 'string_functions' => [], |
||
57 | 'numeric_functions' => [], |
||
58 | 'datetime_functions' => [], |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * Create a Doctrine entity manager. |
||
63 | * |
||
64 | * @param array $options |
||
65 | * |
||
66 | * @throws \Doctrine\DBAL\DBALException |
||
67 | * @throws \Doctrine\ORM\ORMException |
||
68 | * @throws \InvalidArgumentException |
||
69 | * @throws \RuntimeException |
||
70 | * |
||
71 | * @return \Doctrine\ORM\EntityManager |
||
72 | */ |
||
73 | public static function build(array $options) |
||
98 | |||
99 | /** |
||
100 | * Create Doctrine ORM bare configuration. |
||
101 | * |
||
102 | * @param array $options |
||
103 | * |
||
104 | * @throws \InvalidArgumentException |
||
105 | * |
||
106 | * @return \Doctrine\ORM\Configuration |
||
107 | */ |
||
108 | protected static function getConfiguration(array $options) |
||
122 | |||
123 | /** |
||
124 | * Create Doctrine configuration. |
||
125 | * |
||
126 | * @param \Doctrine\ORM\Configuration $config |
||
127 | * @param array $options |
||
128 | * |
||
129 | * @throws \RuntimeException |
||
130 | */ |
||
131 | protected static function setMetadataDriver(Configuration $config, array $options) |
||
161 | |||
162 | /** |
||
163 | * Setup naming strategy. |
||
164 | * |
||
165 | * @param \Doctrine\ORM\Configuration $config |
||
166 | * @param array $options |
||
167 | * |
||
168 | * @throws \InvalidArgumentException |
||
169 | */ |
||
170 | protected static function setupNamingStrategy(Configuration $config, array $options) |
||
179 | |||
180 | /** |
||
181 | * Setup quote strategy. |
||
182 | * |
||
183 | * @param \Doctrine\ORM\Configuration $config |
||
184 | * @param array $options |
||
185 | * |
||
186 | * @throws \InvalidArgumentException |
||
187 | */ |
||
188 | protected static function setupQuoteStrategy(Configuration $config, array $options) |
||
197 | |||
198 | /** |
||
199 | * Setup SQL logger. |
||
200 | * |
||
201 | * @param \Doctrine\ORM\Configuration $config |
||
202 | * @param array $options |
||
203 | */ |
||
204 | protected static function setupSQLLogger(Configuration $config, array $options) |
||
210 | |||
211 | /** |
||
212 | * Setup custom DQL functions. |
||
213 | * |
||
214 | * @param \Doctrine\ORM\Configuration $config |
||
215 | * @param array $options |
||
216 | */ |
||
217 | protected static function setupCustomDQLFunctions(Configuration $config, array $options) |
||
225 | |||
226 | /** |
||
227 | * Setup Custom DBAL types. |
||
228 | * |
||
229 | * @param \Doctrine\DBAL\Connection $connection |
||
230 | * @param array $options |
||
231 | * |
||
232 | * @throws \Doctrine\DBAL\DBALException |
||
233 | * @throws \RuntimeException |
||
234 | */ |
||
235 | protected static function setupCustomDBALTypes(Connection $connection, array $options) |
||
248 | } |
||
249 |