Closed Evertt closed 4 years ago
Which version of MongoDB ODM are you using? This bundle hasn't been updated for ODM 2.0 yet, which may be the problem you're running into.
My composer.json
says "doctrine/mongodb-odm-bundle": "^4.0"
. Which indeed uses ODM 2.0 I see.
However, when I try to install doctrine/mongodb-odm-bundle:^3.6
then I get:
Problem 1
- doctrine/mongodb-odm-bundle 3.6.0 requires doctrine/mongodb ^1.4 -> satisfiable by doctrine/mongodb[1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4].
- doctrine/mongodb-odm-bundle 3.6.1 requires doctrine/mongodb ^1.4 -> satisfiable by doctrine/mongodb[1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4].
- doctrine/mongodb 1.6.4 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.6.3 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.6.2 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.6.1 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.6.0 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.5.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.4.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
- Installation request for doctrine/mongodb-odm-bundle ^3.6 -> satisfiable by doctrine/mongodb-odm-bundle[3.6.0, 3.6.1].
Which confused me at first, because I do have the extension mongodb
installed in my php. But then I noticed that the error is talking about the extension mongo
, and not the extension mongodb
. So I tried running pecl install mongo
and then I get:
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 7.2.22
No valid packages found
install failed
Which suggests that that extension is very outdated. Which makes me think that if FOSOAuthServerBundle requires me to use such an old extension, then I may want to look for another bundle...
This bundle was designed for ODM 1.x, which was built around the legacy MongoDB extension. This legacy extension was dropped in favour of a new extension, as a result of which it wasn't ported to PHP 7. ODM 2.0 now uses the new extension, but contains a significant number of BC breaks, for which this bundle still hasn't been adapter (I haven't gotten to that yet).
However, if you want to run this with MongoDB on PHP 7, you can use my adapter library, which is also documented in the docs for the MongoDB ODM: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/1.3/reference/introduction.html#using-php-7. This library provides the API of the legacy driver, but is built on top of the new driver.
As for ODM 2 support here, the plan is to have version 2.0 of this bundle out soon, which will have full support for ODM 2.0. Apologies for the inconvenience.
Thanks, that worked.
I'm having the same issue but for me the adapter doesn't work because the issue really seems to be in the .xml files. If I change fieldName to field-name temporarily in the Vendor directory everything works as expected. Is there a way to override these xml's in a Symfony 4 project?
Files I would need to override:
What makes it even more strange is that I used Doctrine ORM for the oAuth, not the ODM. Yet it still includes the Mongodb.xml files.
fos_oauth_server: db_driver: orm
Ideally it shouldn't even include the .xml files.
@sjoerdmaessen I believe this is due to the auto_mapping
setting which automatically loads these. I'd have to play around, but if you're using ODM but not for this bundle, you should disable auto_mapping
and define mappings manually.
@alcaeus I would like to use ODM version 2.0 in my project. When are you planning support for ODM ^ 2.0?
@arekmalek1 I am not working on this project anymore, as my current workload does not allow for it. If you are interested in using this with 2.0, I encourage you to create a pull request with the necessary changes. If you need help with the migration from 1.x to 2.0, you are welcome to ping me in the Symfony Slack, but be aware that my responses may be delayed.
Can you please merge https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/669 this PR into dev-master branch.
@alcaeus dev-1.6 version not supported for PHP 8.0. Currently I am trying with below configuration
php8.1 version and Symfony 5.4 and mongodb-odm 2.0.
When installing this package (at version dev-master) I get.
I checked the file
Client.mongodb.xml
and indeed it says that the attributefieldName
should actually be calledfield-name
. I was hoping that I could just ignore this error by not using mongodb, but orm instead.But that doesn't seem to make a difference. What do I do?