Closed marcusorjames closed 6 years ago
Hi @marcusorjames, this adapter is written to be used with MongoDB extension. For doctrine ODM, I've written a PR #18 that introduce DoctrineODM Adapter.
If you want to try this adapter you can declare a class ODMAdapter and copy the content of my file into your a class and in createAdapter method you can pass your custom adapter.
Let me know!
Amazing, yup thought I was missing something obvious. I will give it a go :)
MongoAdaptor isn't finished yet.
While more or less true, we're actually using it internally in production, just not in a very fancy way :)
The provided MongoDBAdapter
is indeed as @giovannialbero1992 stated meant to 'adapt' the MongoDB extension itself.
Keep us posted if you run into any issues so we can improve it together!
Right, so I am using Symfony 3 PHP7 with the alcaeus/mongo-php-adapter, looking at it it looks like mongodb-odm uses an old version of mongo-ext which the above adaptor is a work around: https://stackoverflow.com/questions/36964171/php-7-with-doctrine-mongodb-odm
So I am getting the "Install doctrine/mongodb-odm-bundle to use the ODMAdapter" exception.
Not sure what magic injects the registry into the adaptor extension?
Any ideas?
@marcusorjames do you have installed doctrine/mongodb-odm-bundle ? If yes you should have "autowire" set to true and declare into service.yaml
Doctrine\Bundle\MongoDBBundle\ManagerRegistry:
alias: 'doctrine_mongodb'
Closing as inactive.
Hi, Does anyone have any examples of how to implement this with Doctrine MongoDB. The Adaptor seems to need to take a Collection how would I create this and then pass it in? The documentation just shows a string which is obviously incorrect. I've tried passing in for example from the document manager:
But this returns a "LoggableCollection" which fails the options validation, allowing a LoggableCollection then throws a "Projection cannot have a mix of inclusion and exclusion."
I feel I am missing something obvious here / MongoAdaptor isn't finished yet.
If anyone can help that would be great, I love the way this bundle is written and would love to use it.