Storing images in mongoDB


#1

Hello!

Tried following guide to store images in MonogDb https://docs.sylius.com/en/latest/cookbook/images/images-gridfs.html

But still cant get it to work.

Getting:
Argument 1 passed to Gaufrette\Adapter\GridFS::__construct() must be an instance of MongoDB\GridFS\Bucket, instance of MongoGridFS given

My services.yaml (sorry for missing indentation)

app.gaufrette_loader.doctrine_grid_fs:
class: Doctrine\MongoDB\GridFS
public: false
arguments: [App\Document\Product\Image]
factory: [’@doctrine.odm.mongodb.document_manager’, getDocumentCollection]
app.gaufrette_loader.grid_fs:
class: MongoGridFS
factory: [’@app.gaufrette_loader.doctrine_grid_fs’, getMongoCollection]

Maybe there are some more dependencies to get this working since phpstorm says ‘doctrine.odm.mongodb.document_manager’ service is missing, or cookbook is a little out of date? :confused:

Also i am using annotation mapping, could it be that ‘App\Document\Product\Image’ just have wrong mapping?

Any help or links to right documentation are appreciated.