3

((Symfony 2.7 / 3 - Doctrine: You have requested a non-existent service "fos_user.doctrine_registry") this fix did not work for me. Something in an update broken and going to the old version fixed it.))

I am trying to move my app from doctrine to mongodb.

I followed this to the letter and I am getting the following error.

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "fos_user.doctrine_registry".

I have narrowed it down to the providers section but everything I have tried cannot get past the error.

Has anyone else successfully used mongo with FOSUser?

Thank you.

Community
  • 1
  • 1
smugford
  • 769
  • 2
  • 10
  • 20
  • Put here more information. Where this error is occurred? When? What is in your `config.yml` file? Did you try to clear the cache? Do you have services that are dependent on Doctrine ORM? – Michael Sivolobov Jan 27 '16 at 02:37
  • Not just adding a me too; I have been using FOSUser on Mongo successfully for the past few months but, after performing an update am facing similar issues. Looking in to the matter now – Simon Jan 27 '16 at 02:40
  • If it counts for anything, downgrading both FOSUser and MongoDB to earlier versions fixed this issue for me. Looking at the Github page, I see FOSUser is changing the way it detects Doctrine; go to a version before the following commit https://github.com/FriendsOfSymfony/FOSUserBundle/commit/b7e4a67a873d4e1594f0bdaca34d969efedb2903 – Simon Jan 27 '16 at 02:50
  • You can follow up the issue [here](https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2048). There's a short term fix: define an alias in your config.yml file: services: fos_user.doctrine_registry: alias: doctrine – Carles Jan 27 '16 at 08:45
  • 1
    also see [this](http://stackoverflow.com/questions/35031401/synfony3-doctrine-you-have-requested-a-non-existent-service-fos-user-doctrine-r) – Carles Jan 27 '16 at 08:46

2 Answers2

4

Getting the latest friendsofsymfony/user-bundle "~2.0@dev" broke this for me too.

Some versions are broken: https://github.com/FriendsOfSymfony/FOSUserBundle/releases

Use version "2.0.0-alpha1" to fix it. If you get another error then use "2.0.0-alpha3"

"friendsofsymfony/user-bundle": "2.0.0-alpha1",
Aris
  • 4,643
  • 1
  • 41
  • 38
  • 1
    I ran into another bug in 2.0.0-alpha1. This solution worked for me: http://stackoverflow.com/questions/35031401/symfony-2-7-3-doctrine-you-have-requested-a-non-existent-service-fos-user/35032097 – Joe Feb 01 '16 at 21:27
4

in your app/config/config.yml, you have to alias fos_user.doctrine_registry to doctrine

services:
    fos_user.doctrine_registry:
        alias: doctrine