Skip to content

Commit e2e866a

Browse files
committed
Remove the CouchDB integration
1 parent c7ae534 commit e2e866a

9 files changed

Lines changed: 5 additions & 209 deletions

File tree

docs/index.rst

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -216,44 +216,6 @@ this to start:
216216
}
217217
}
218218
219-
c) CouchDB User class
220-
.....................
221-
222-
.. note::
223-
Support for the CouchDB ODM is deprecated as the Doctrine CouchDB ODM is unmaintained.
224-
225-
If you're persisting your users via the Doctrine CouchDB ODM, then your ``User``
226-
class should live in the ``CouchDocument`` namespace of your bundle and look
227-
like this to start:
228-
229-
.. code-block:: php
230-
231-
<?php
232-
// src/AppBundle/CouchDocument/User.php
233-
234-
namespace AppBundle\CouchDocument;
235-
236-
use FOS\UserBundle\Model\User as BaseUser;
237-
use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;
238-
239-
/**
240-
* @CouchDB\Document
241-
*/
242-
class User extends BaseUser
243-
{
244-
/**
245-
* @CouchDB\Id
246-
*/
247-
protected $id;
248-
249-
public function __construct()
250-
{
251-
parent::__construct();
252-
// your own logic
253-
}
254-
}
255-
256-
257219
Step 4: Configure your application's security.yml
258220
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259221

@@ -351,7 +313,7 @@ of datastore you are using.
351313
352314
# app/config/config.yml
353315
fos_user:
354-
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'custom'
316+
db_driver: orm # other valid values are 'mongodb' and 'custom'
355317
firewall_name: main
356318
user_class: AppBundle\Entity\User
357319
from_email:
@@ -362,7 +324,7 @@ of datastore you are using.
362324
363325
<!-- app/config/config.xml -->
364326
365-
<!-- other valid 'db-driver' values are 'mongodb', 'couchdb' and 'custom' -->
327+
<!-- other valid 'db-driver' values are 'mongodb' and 'custom' -->
366328
<fos_user:config
367329
db-driver="orm"
368330
firewall-name="main"
@@ -371,7 +333,7 @@ of datastore you are using.
371333
372334
Only four configuration's nodes are required to use the bundle:
373335

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

docs/user_manager.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ of ``FOS\UserBundle\Doctrine\UserManager``.
1313
If you configure the ``db_driver`` option to ``mongodb``, this service is an
1414
instance of ``FOS\UserBundle\Doctrine\UserManager``.
1515

16-
If you configure the ``db_driver`` option to ``couchdb``, this service is an
17-
instance of ``FOS\UserBundle\Doctrine\UserManager``.
18-
1916
Accessing the User Manager service
2017
----------------------------------
2118

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getConfigTreeBuilder(): TreeBuilder
3333
$treeBuilder = new TreeBuilder('fos_user');
3434
$rootNode = $treeBuilder->getRootNode();
3535

36-
$supportedDrivers = ['orm', 'mongodb', 'couchdb', 'custom'];
36+
$supportedDrivers = ['orm', 'mongodb', 'custom'];
3737

3838
$rootNode
3939
->children()
@@ -42,14 +42,6 @@ public function getConfigTreeBuilder(): TreeBuilder
4242
->ifNotInArray($supportedDrivers)
4343
->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers))
4444
->end()
45-
->validate()
46-
->ifInArray(['couchdb'])
47-
->then(function ($v) {
48-
trigger_deprecation('friendsofsymfony/user-bundle', '3.3.0', 'The CouchDB ODM integration is deprecated because the CouchDB ODM itself is unmaintained.');
49-
50-
return $v;
51-
})
52-
->end()
5345
->cannotBeOverwritten()
5446
->isRequired()
5547
->cannotBeEmpty()

src/DependencyInjection/FOSUserExtension.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
final class FOSUserExtension extends Extension
2727
{
2828
/**
29-
* @var array<string, array{registry: string, tag: string, listener_class?: string}>
29+
* @var array<string, array{registry: string, tag: string}>
3030
*/
3131
private static $doctrineDrivers = [
3232
'orm' => [
@@ -37,11 +37,6 @@ final class FOSUserExtension extends Extension
3737
'registry' => 'doctrine_mongodb',
3838
'tag' => 'doctrine_mongodb.odm.event_listener',
3939
],
40-
'couchdb' => [
41-
'registry' => 'doctrine_couchdb',
42-
'tag' => 'doctrine_couchdb.event_listener',
43-
'listener_class' => 'FOS\UserBundle\Doctrine\CouchDB\UserListener',
44-
],
4540
];
4641

4742
private bool $mailerNeeded = false;
@@ -97,9 +92,6 @@ public function load(array $configs, ContainerBuilder $container): void
9792
$listenerDefinition = $container->getDefinition('fos_user.user_listener');
9893
$listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'prePersist']);
9994
$listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'preUpdate']);
100-
if (isset(self::$doctrineDrivers[$config['db_driver']]['listener_class'])) {
101-
$listenerDefinition->setClass(self::$doctrineDrivers[$config['db_driver']]['listener_class']);
102-
}
10395
}
10496

10597
if ($config['use_username_form_type']) {

src/Doctrine/CouchDB/UserListener.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/FOSUserBundle.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle;
1313

14-
use Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass;
1514
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
1615
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
1716
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass;
@@ -55,9 +54,5 @@ private function addRegisterMappingsPass(ContainerBuilder $container): void
5554
if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) {
5655
$container->addCompilerPass(DoctrineMongoDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_mongodb'));
5756
}
58-
59-
if (class_exists('Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass')) {
60-
$container->addCompilerPass(DoctrineCouchDBMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_couchdb'));
61-
}
6257
}
6358
}

src/Resources/config/doctrine-mapping/User.couchdb.xml

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Resources/config/storage-validation/couchdb.xml

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/DependencyInjection/FOSUserExtensionTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -373,28 +373,6 @@ public function userManagerSetFactoryProvider()
373373
];
374374
}
375375

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-
398376
protected function createEmptyConfiguration()
399377
{
400378
$this->configuration = new ContainerBuilder();

0 commit comments

Comments
 (0)