1 | <?php |
||
25 | class ManagerBuilder extends AbstractBuilderCollection |
||
26 | { |
||
27 | use OptionsTrait; |
||
28 | |||
29 | const METADATA_MAPPING_ANNOTATION = Builder::METADATA_MAPPING_ANNOTATION; |
||
30 | const METADATA_MAPPING_XML = Builder::METADATA_MAPPING_XML; |
||
31 | const METADATA_MAPPING_YAML = Builder::METADATA_MAPPING_YAML; |
||
32 | const METADATA_MAPPING_PHP = Builder::METADATA_MAPPING_PHP; |
||
33 | |||
34 | const RELATIONAL_MANAGER_KEY = 'relational_manager_key'; |
||
35 | const MONGODB_MANAGER_KEY = 'mongodb_manager_key'; |
||
36 | const COUCHDB_MANAGER_KEY = 'couchdb_manager_key'; |
||
37 | |||
38 | const DEFAULT_RELATIONAL_MANAGER_KEY = 'entity_manager'; |
||
39 | const DEFAULT_MONGODB_MANAGER_KEY = 'mongodb_document_manager'; |
||
40 | const DEFAULT_COUCHDB_MANAGER_KEY = 'couchdb_document_manager'; |
||
41 | |||
42 | const RELATIONAL_MANAGER_NAME = 'relational_manager_name'; |
||
43 | const MONGODB_MANAGER_NAME = 'mongodb_manager_name'; |
||
44 | const COUCHDB_MANAGER_NAME = 'couchdb_manager_name'; |
||
45 | |||
46 | const DEFAULT_RELATIONAL_MANAGER_NAME = 'entityManager'; |
||
47 | const DEFAULT_MONGODB_MANAGER_NAME = 'mongoDocumentManager'; |
||
48 | const DEFAULT_COUCHDB_MANAGER_NAME = 'couchDocumentManager'; |
||
49 | |||
50 | /** |
||
51 | * Global annotation loader control. |
||
52 | * |
||
53 | * @var bool |
||
54 | */ |
||
55 | protected $globalLoaderRegister = true; |
||
56 | |||
57 | /** |
||
58 | * ManagerBuilder constructor. |
||
59 | * |
||
60 | * @param array $options |
||
61 | */ |
||
62 | public function __construct(array $options = []) |
||
78 | |||
79 | /** |
||
80 | * Load Doctrine managers from settings array. |
||
81 | * |
||
82 | * @param array $settings |
||
83 | * |
||
84 | * @throws \RuntimeException |
||
85 | * |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function loadSettings(array $settings) |
||
107 | |||
108 | /** |
||
109 | * Register ORM entity managers. |
||
110 | * |
||
111 | * @param array $settings |
||
112 | * |
||
113 | * @throws \RuntimeException |
||
114 | */ |
||
115 | protected function registerEntityManagers(array $settings) |
||
129 | |||
130 | /** |
||
131 | * Register MongoDB ODM document managers. |
||
132 | * |
||
133 | * @param array $settings |
||
134 | * |
||
135 | * @throws \RuntimeException |
||
136 | */ |
||
137 | protected function registerMongoDBDocumentManagers(array $settings) |
||
151 | |||
152 | /** |
||
153 | * Register CouchDB ODM document managers. |
||
154 | * |
||
155 | * @param array $settings |
||
156 | * |
||
157 | * @throws \RuntimeException |
||
158 | */ |
||
159 | protected function registerCouchDBDocumentManagers(array $settings) |
||
173 | |||
174 | /** |
||
175 | * Get registered builder's managers. |
||
176 | * |
||
177 | * @return \Doctrine\Common\Persistence\ObjectManager[] |
||
178 | */ |
||
179 | public function getManagers() |
||
192 | |||
193 | /** |
||
194 | * Get registered builder's manager. |
||
195 | * |
||
196 | * @param string $name |
||
197 | * |
||
198 | * @throws \RuntimeException |
||
199 | * |
||
200 | * @return \Doctrine\Common\Persistence\ObjectManager |
||
201 | */ |
||
202 | public function getManager($name) |
||
215 | |||
216 | /** |
||
217 | * Get console application. |
||
218 | * |
||
219 | * @return Application |
||
220 | */ |
||
221 | public function getCLIApplication() |
||
238 | |||
239 | /** |
||
240 | * Register global annotation loader. |
||
241 | * class_exists function. |
||
242 | */ |
||
243 | protected function registerGlobalAnnotationLoader() |
||
251 | } |
||
252 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: