@@ -87,6 +87,87 @@ Our new `src/App/src/ConfigProvider.php` class would look like this now:
8787![ Config provider factories update] ( images/config-provider-1.png )
8888![ Doctrine config function] ( images/config-provider-2.png )
8989
90+ ``` php
91+ public function __invoke(): array
92+ {
93+ return [
94+ 'dependencies' => $this->getDependencies(),
95+ 'doctrine' => $this->getDoctrineConfig(),
96+ 'templates' => $this->getTemplates(),
97+ ];
98+ }
99+
100+ public function getDependencies(): array
101+ {
102+ return [
103+ 'delegators' => [
104+ Application::class => [
105+ RoutesDelegator::class,
106+ ],
107+ ],
108+ 'factories' => [
109+ 'doctrine.entity_manager.orm_default' => EntityManagerFactory::class,
110+ GetIndexViewHandler::class => GetIndexViewHandlerFactory::class,
111+ ],
112+ 'aliases' => [
113+ EntityManager::class => 'doctrine.entity_manager.orm_default',
114+ EntityManagerInterface::class => 'doctrine.entity_manager.orm_default',
115+ ],
116+ ];
117+ }
118+
119+ private function getDoctrineConfig(): array
120+ {
121+ return [
122+ 'cache' => [
123+ 'array' => [
124+ 'class' => ArrayAdapter::class,
125+ ],
126+ 'filesystem' => [
127+ 'class' => FilesystemAdapter::class,
128+ 'directory' => getcwd() . '/data/cache',
129+ 'namespace' => 'doctrine',
130+ ],
131+ ],
132+ 'configuration' => [
133+ 'orm_default' => [
134+ 'entity_listener_resolver' => EntityListenerResolverInterface::class,
135+ 'result_cache' => 'filesystem',
136+ 'metadata_cache' => 'filesystem',
137+ 'query_cache' => 'filesystem',
138+ 'hydration_cache' => 'array',
139+ 'typed_field_mapper' => null,
140+ 'second_level_cache' => [
141+ 'enabled' => true,
142+ 'default_lifetime' => 3600,
143+ 'default_lock_lifetime' => 60,
144+ 'file_lock_region_directory' => '',
145+ 'regions' => [],
146+ ],
147+ ],
148+ ],
149+ 'driver' => [
150+ // The default metadata driver aggregates all other drivers into a single one.
151+ // Override `orm_default` only if you know what you're doing.
152+ 'orm_default' => [
153+ 'class' => MappingDriverChain::class,
154+ ],
155+ ],
156+ 'migrations' => [
157+ // Modify this line based on where you would like to have you migrations
158+ 'migrations_paths' => [
159+ 'Migrations' => 'src/Migrations',
160+ ],
161+ 'all_or_nothing' => true,
162+ 'check_database_platform' => true,
163+ ],
164+ 'types' => [
165+ UuidType::NAME => UuidType::class,
166+ ],
167+ ];
168+ }
169+ ```
170+
90171We also require a new file ` config/cli-config.php ` .
91172It initializes and returns a ` DependencyFactory ` that Doctrine Migrations uses to run migrations.
92173
0 commit comments