Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Cache] Fix doc for Doctrine DBAL adapter#18698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
+115 −108
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
23 changes: 12 additions & 11 deletionscache.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletionscomponents/cache/adapters/doctrine_dbal_adapter.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| .. _doctrine-dbal-adapter: | ||
| Doctrine DBAL Cache Adapter | ||
| =========================== | ||
| The Doctrine DBAL adapters store the cache items in a table of an SQL database. | ||
| .. note:: | ||
| This adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`, | ||
| allowing for manual :ref:`pruning of expired cache entries <component-cache-cache-pool-prune>` | ||
| by calling the ``prune()`` method. | ||
| The :class:`Symfony\\Component\\Cache\\Adapter\\DoctrineDbalAdapter` requires a | ||
| `Doctrine DBAL Connection`_, or `Doctrine DBAL URL`_ as its first parameter. | ||
| You can pass a namespace, default cache lifetime, and options array as the other | ||
| optional arguments:: | ||
| use Symfony\Component\Cache\Adapter\DoctrineDbalAdapter; | ||
| $cache = new DoctrineDbalAdapter( | ||
| // a Doctrine DBAL connection or DBAL URL | ||
| $databaseConnectionOrURL, | ||
| // the string prefixed to the keys of the items stored in this cache | ||
| $namespace = '', | ||
| // the default lifetime (in seconds) for cache items that do not define their | ||
| // own lifetime, with a value 0 causing items to be stored indefinitely (i.e. | ||
| // until the database table is truncated or its rows are otherwise deleted) | ||
| $defaultLifetime = 0, | ||
| // an array of options for configuring the database table and connection | ||
| $options = [] | ||
| ); | ||
| .. note:: | ||
| DBAL Connection are lazy-loaded by default; some additional options may be | ||
| necessary to detect the database engine and version without opening the | ||
| connection. | ||
| .. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/src/Connection.php | ||
| .. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url |
2 changes: 1 addition & 1 deletioncomponents/cache/adapters/filesystem_adapter.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletionscomponents/cache/adapters/pdo_adapter.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| .. _pdo-adapter: | ||
| PDO Cache Adapter | ||
| ================= | ||
| The PDO adapters store the cache items in a table of an SQL database. | ||
| .. note:: | ||
| This adapter implements :class:`Symfony\\Component\\Cache\\PruneableInterface`, | ||
| allowing for manual :ref:`pruning of expired cache entries <component-cache-cache-pool-prune>` | ||
| by calling the ``prune()`` method. | ||
| The :class:`Symfony\\Component\\Cache\\Adapter\\PdoAdapter` requires a :phpclass:`PDO`, | ||
| or `DSN`_ as its first parameter. You can pass a namespace, | ||
| default cache lifetime, and options array as the other optional arguments:: | ||
| use Symfony\Component\Cache\Adapter\PdoAdapter; | ||
| $cache = new PdoAdapter( | ||
| // a PDO connection or DSN for lazy connecting through PDO | ||
| $databaseConnectionOrDSN, | ||
| // the string prefixed to the keys of the items stored in this cache | ||
| $namespace = '', | ||
| // the default lifetime (in seconds) for cache items that do not define their | ||
| // own lifetime, with a value 0 causing items to be stored indefinitely (i.e. | ||
| // until the database table is truncated or its rows are otherwise deleted) | ||
| $defaultLifetime = 0, | ||
| // an array of options for configuring the database table and connection | ||
| $options = [] | ||
| ); | ||
| The table where values are stored is created automatically on the first call to | ||
| the :method:`Symfony\\Component\\Cache\\Adapter\\PdoAdapter::save` method. | ||
| You can also create this table explicitly by calling the | ||
| :method:`Symfony\\Component\\Cache\\Adapter\\PdoAdapter::createTable` method in | ||
| your code. | ||
| .. deprecated:: 5.4 | ||
| Using :class:`Symfony\\Component\\Cache\\Adapter\\PdoAdapter` with a | ||
| :class:`Doctrine\\DBAL\\Connection` or a DBAL URL is deprecated since Symfony 5.4 | ||
| and will be removed in Symfony 6.0. | ||
| Use :class:`Symfony\\Component\\Cache\\Adapter\\DoctrineDbalAdapter` instead. | ||
| .. tip:: | ||
| When passed a `Data Source Name (DSN)`_ string (instead of a database connection | ||
| class instance), the connection will be lazy-loaded when needed. | ||
| .. _`DSN`: https://php.net/manual/pdo.drivers.php |
95 changes: 0 additions & 95 deletionscomponents/cache/adapters/pdo_doctrine_dbal_adapter.rst
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
3 changes: 2 additions & 1 deletioncomponents/cache/cache_pools.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.