api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.41k stars 862 forks source link

Call to a member function getClassMetadata() on null with @ApiFilter #3108

Closed thommycgn closed 4 years ago

thommycgn commented 5 years ago

If I want to use @ApiFilter(...) (any Search or Order) with MongoDB it alwas results in "Call to a member function getClassMetadata() on null".

Im using:
"doctrine/mongodb-odm": 2.0.0-RC1, "doctrine/mongodb-odm-bundle": 4.0.0-RC1,

It's working with MySql...

Call to a member function getClassMetadata() on null (500 Internal Server Error)

soyuka commented 5 years ago

Looks like your class isn't mapped on the ODM

dunglas commented 4 years ago

Can we close this one? Or should we patch something?

soyuka commented 4 years ago

Issue is on the user side.

dariuskasperavicius commented 3 years ago

Author was using ORM OrderFilter (it happens if you copy line by line from documentation). Solution is very simple. Author should use this instead: use ApiPlatform\Core\Bridge\Doctrine\MongoDbOdm\Filter\OrderFilter;

I think you can close this one.