Skip to content

Commit d82fae0

Browse files
committed
minor #19416 [Cache] Document using DSN with PDOAdapter (HypeMC)
This PR was merged into the 7.1 branch. Discussion ---------- [Cache] Document using DSN with PDOAdapter Fix #19415. Commits ------- 1bd5535 [Cache] Document using DSN with PDOAdapter
2 parents d52f563 + 1bd5535 commit d82fae0

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

cache.rst

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,7 @@ Some of these adapters could be configured via shortcuts.
133133
default_psr6_provider: 'app.my_psr6_service'
134134
default_redis_provider: 'redis://localhost'
135135
default_memcached_provider: 'memcached://localhost'
136-
default_pdo_provider: 'app.my_pdo_service'
137-
138-
services:
139-
app.my_pdo_service:
140-
class: \PDO
141-
arguments: ['pgsql:host=localhost']
136+
default_pdo_provider: 'pgsql:host=localhost'
142137
143138
.. code-block:: xml
144139
@@ -159,24 +154,17 @@ Some of these adapters could be configured via shortcuts.
159154
default-psr6-provider="app.my_psr6_service"
160155
default-redis-provider="redis://localhost"
161156
default-memcached-provider="memcached://localhost"
162-
default-pdo-provider="app.my_pdo_service"
157+
default-pdo-provider="pgsql:host=localhost"
163158
/>
164159
</framework:config>
165-
166-
<services>
167-
<service id="app.my_pdo_service" class="\PDO">
168-
<argument>pgsql:host=localhost</argument>
169-
</service>
170-
</services>
171160
</container>
172161
173162
.. code-block:: php
174163
175164
// config/packages/cache.php
176-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
177165
use Symfony\Config\FrameworkConfig;
178166
179-
return static function (FrameworkConfig $framework, ContainerConfigurator $container): void {
167+
return static function (FrameworkConfig $framework): void {
180168
$framework->cache()
181169
// Only used with cache.adapter.filesystem
182170
->directory('%kernel.cache_dir%/pools')
@@ -185,15 +173,14 @@ Some of these adapters could be configured via shortcuts.
185173
->defaultPsr6Provider('app.my_psr6_service')
186174
->defaultRedisProvider('redis://localhost')
187175
->defaultMemcachedProvider('memcached://localhost')
188-
->defaultPdoProvider('app.my_pdo_service')
189-
;
190-
191-
$container->services()
192-
->set('app.my_pdo_service', \PDO::class)
193-
->args(['pgsql:host=localhost'])
176+
->defaultPdoProvider('pgsql:host=localhost')
194177
;
195178
};
196179
180+
.. versionadded:: 7.1
181+
182+
Using a DSN as the provider for the PDO adapter was introduced in Symfony 7.1.
183+
197184
.. _cache-create-pools:
198185

199186
Creating Custom (Namespaced) Pools

0 commit comments

Comments
 (0)