Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define service for adapter with GridFS #214

Open
sha256-mercury opened this issue May 3, 2019 · 1 comment
Open

define service for adapter with GridFS #214

sha256-mercury opened this issue May 3, 2019 · 1 comment
Assignees

Comments

@sha256-mercury
Copy link

sha256-mercury commented May 3, 2019

Hello, I want to use GridFs in my Symfony application. The default configuration on the GridFs seems to not walk well. I'm using knplabs/knp-gaufrette-bundle v0.5.3, gaufrette/gridfs-adapter v0.4.0 and mongodb/mongodb 1.1.2. There is my service configuration

   app.mongo:
            class: Mongo
        arguments: [%app.mongo.server%, %pp.mongo.options%]
    app.mongodb:
        class: MongoDB
        arguments: [@app.mongo, %app.mongodb.name%]
    app.gridfs:
        class: MongoGridFS
        arguments: [@app.mongodb, %app.gridfs.prefix%]

When I tried to debug, I have this error
Type error: Argument 1 passed to Gaufrette\Adapter\GridFS::__construct() must be an instance of MongoDB\GridFS\Bucket, instance of MongoGridFS given
I have to define an instance of MongoDB\GridFS\Bucket as a service but I did not find the class MongoDB\Driver\Manager .
Please there is somebody who can help me ?

@theyough
Copy link

you can replace:

   app.mongo:
            class: Mongo
        arguments: [%app.mongo.server%, %pp.mongo.options%]
    app.mongodb:
        class: MongoDB
        arguments: [@app.mongo, %app.mongodb.name%]
    app.gridfs:
        class: MongoGridFS
        arguments: [@app.mongodb, %app.gridfs.prefix%]

By:

    app.gridfs:
        class: MongoDB\GridFS\Bucket
        arguments:
            $databaseName: %database_name%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants