Skip to content

Commit 495bab8

Browse files
committed
Deprecate the CouchDB ODM integration
This ODM is not maintained anymore by the Doctrine team.
1 parent 682ebb6 commit 495bab8

File tree

6 files changed

+42
-8
lines changed

6 files changed

+42
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ common tasks such as user registration and password retrieval.
77

88
Features include:
99

10-
- Users can be stored via Doctrine ORM or MongoDB/CouchDB ODM
10+
- Users can be stored via Doctrine ORM or MongoDB ODM
1111
- Registration support, with an optional confirmation per email
1212
- Password reset support
1313
- Unit tested

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"ext-json": "*",
2727
"symfony/config": "^4.4 || ^5.0 || ^6.0",
2828
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
29+
"symfony/deprecation-contracts": "^2.5 || ^3.5",
2930
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0",
3031
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0 || ^3.0",
3132
"symfony/form": "^4.4 || ^5.0 || ^6.0",

docs/index.rst

+8-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Step 3: Create your User class
8181
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8282

8383
The goal of this bundle is to persist some ``User`` class to a database (MySql,
84-
MongoDB, CouchDB, etc). Your first job, then, is to create the ``User`` class
84+
MongoDB, etc). Your first job, then, is to create the ``User`` class
8585
for your application. This class can look and act however you want: add any
8686
properties or methods you find useful. This is *your* ``User`` class.
8787

@@ -98,8 +98,7 @@ to make it easier to create your entity. Here is how you use it:
9898
redefine the mapping for the other fields as it is provided by the bundle.
9999

100100
In the following sections, you'll see examples of how your ``User`` class should
101-
look, depending on how you're storing your users (Doctrine ORM, MongoDB ODM,
102-
or CouchDB ODM).
101+
look, depending on how you're storing your users (Doctrine ORM or MongoDB ODM).
103102

104103
.. note::
105104

@@ -220,6 +219,9 @@ this to start:
220219
c) CouchDB User class
221220
.....................
222221

222+
.. note::
223+
Support for the CouchDB ODM is deprecated as the Doctrine CouchDB ODM is unmaintained.
224+
223225
If you're persisting your users via the Doctrine CouchDB ODM, then your ``User``
224226
class should live in the ``CouchDocument`` namespace of your bundle and look
225227
like this to start:
@@ -349,7 +351,7 @@ of datastore you are using.
349351
350352
# app/config/config.yml
351353
fos_user:
352-
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
354+
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'custom'
353355
firewall_name: main
354356
user_class: AppBundle\Entity\User
355357
from_email:
@@ -360,7 +362,7 @@ of datastore you are using.
360362
361363
<!-- app/config/config.xml -->
362364
363-
<!-- other valid 'db-driver' values are 'mongodb' and 'couchdb' -->
365+
<!-- other valid 'db-driver' values are 'mongodb', 'couchdb' and 'custom' -->
364366
<fos_user:config
365367
db-driver="orm"
366368
firewall-name="main"
@@ -369,7 +371,7 @@ of datastore you are using.
369371
370372
Only four configuration's nodes are required to use the bundle:
371373

372-
* The type of datastore you are using (``orm``, ``mongodb`` or ``couchdb``).
374+
* The type of datastore you are using (``orm``, ``mongodb``, ``couchdb`` or ``custom```).
373375
* The firewall name which you configured in Step 4.
374376
* The fully qualified class name (FQCN) of the ``User`` class which you created in Step 3.
375377
* The default email address to use when the bundle send a registration confirmation to the user.

src/DependencyInjection/Configuration.php

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public function getConfigTreeBuilder(): TreeBuilder
4444
->ifNotInArray($supportedDrivers)
4545
->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers))
4646
->end()
47+
->validate()
48+
->ifInArray(['couchdb'])
49+
->then(function ($v) {
50+
trigger_deprecation('friendsofsymfony/user-bundle', '3.3.0', 'The CouchDB ODM integration is deprecated because the CouchDB ODM itself is unmaintained.');
51+
52+
return $v;
53+
})
54+
->end()
4755
->cannotBeOverwritten()
4856
->isRequired()
4957
->cannotBeEmpty()

src/Doctrine/CouchDB/UserListener.php

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* @internal
2323
*
2424
* @final
25+
*
26+
* @deprecated The CouchDB ODM integration is deprecated since 3.3.0 because the CouchDB ODM itself is unmaintained.
2527
*/
2628
class UserListener implements EventSubscriber
2729
{

tests/DependencyInjection/FOSUserExtensionTest.php

+22-1
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,32 @@ public function userManagerSetFactoryProvider()
369369
{
370370
return [
371371
['orm', 'doctrine'],
372-
['couchdb', 'doctrine_couchdb'],
373372
['mongodb', 'doctrine_mongodb'],
374373
];
375374
}
376375

376+
/**
377+
* @group legacy
378+
*/
379+
public function testUserManagerSetFactoryCouchdb()
380+
{
381+
$this->configuration = new ContainerBuilder();
382+
$loader = new FOSUserExtension();
383+
$config = $this->getEmptyConfig();
384+
$config['db_driver'] = 'couchdb';
385+
$loader->load([$config], $this->configuration);
386+
387+
$definition = $this->configuration->getDefinition('fos_user.object_manager');
388+
389+
$this->assertAlias('doctrine_couchdb', 'fos_user.doctrine_registry');
390+
391+
$factory = $definition->getFactory();
392+
393+
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $factory[0]);
394+
$this->assertSame('fos_user.doctrine_registry', (string) $factory[0]);
395+
$this->assertSame('getManager', $factory[1]);
396+
}
397+
377398
protected function createEmptyConfiguration()
378399
{
379400
$this->configuration = new ContainerBuilder();

0 commit comments

Comments
 (0)