Reputation: 47
I have this problem when i try to do
app/console doctrine:mongodb:schema:update
on the terminal :
[Symfony\Component\Debug\Exception\ClassNotFoundException] Attempted to load class "MongoClient" from the global namespace. Did you forget a "use" statement?
I tried everything I found. Anyone can help me please?
Upvotes: 1
Views: 3527
Reputation: 349
I can see you're using Doctrine MongoDB ODM. Doctrine MongoDB ODM relies on legacy mongo driver ext-mongo
, that is available only to PHP up to 5.6. If you're using PHP up to 5.6 you just have to install and enable it.
If you're using PHP7+ you have to install the new mongo driver ext-mongodb
and use a polyfill to bridge the Doctrine MongoDB ODM with the new library, as stated here: http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/introduction.html#using-php-7
You can use Doctrine MongoDB ODM with PHP 7, but there are a few extra steps during the installation. Since the legacy driver (referred to as ext-mongo) is not available on PHP 7, you will need the new driver (ext-mongodb) installed and use a polyfill to provide the API of the legacy driver.
Upvotes: 3