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

GridFSLoader bug #305

Closed
npinon opened this issue Jan 22, 2014 · 15 comments · Fixed by #331
Closed

GridFSLoader bug #305

npinon opened this issue Jan 22, 2014 · 15 comments · Fixed by #331
Labels
Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality.

Comments

@npinon
Copy link

npinon commented Jan 22, 2014

Since the update of mongodb-odm package (661a3b3) I have this error :

Fatal error: Call to a member function getCollection() on a non-object in /vendor/liip/imagine-bundle/Liip/ImagineBundle/Imagine/Data/Loader/GridFSLoader.php on line 48

It happened when I try to load an image from mongogridfs.

Maybe something has changed.
Can someone correct the problem?

@havvg
Copy link
Contributor

havvg commented Jan 28, 2014

Please give us the exact versions you were using and you are using now.

@npinon
Copy link
Author

npinon commented Jan 28, 2014

Now I use :

        "doctrine/mongodb-odm" : "dev-master#bbcfedf",
        "doctrine/mongodb-odm-bundle" : "dev-master",
        "liip/imagine-bundle": "dev-master",

I have forced an old version of mongodb-odm and it worked.

With the commit 661a3b3 of mongodb-odm I had the bug above.

@peterrehm
Copy link
Contributor

@npinon Have you found a solution? Same appears on my side.

@peterrehm
Copy link
Contributor

It seems that changing the GridFsLoader::find() method with the following fixes the issue:

/**
 * {@inheritDoc}
 */
public function find($id)
{
    $image = $this->dm
        ->getRepository($this->class)
        ->find(new \MongoId($id));

    if (!$image) {
        throw new NotFoundHttpException(sprintf('Source image not found with id "%s"', $id));
    }

    return $this->imagine->load($image->getFile()->getBytes());
}

@npinon
Copy link
Author

npinon commented Feb 19, 2014

Looks nice!
Thx

@havvg
Copy link
Contributor

havvg commented Feb 20, 2014

@npinon Can you confirm, the changes solve this issue?

@npinon
Copy link
Author

npinon commented Feb 20, 2014

I confirm. It works!

@peterrehm
Copy link
Contributor

@havvg Could you consider tagging a minor bugfix release?

@havvg
Copy link
Contributor

havvg commented Feb 20, 2014

@peterrehm
Copy link
Contributor

Oh thanks. I have not seen that since GitHub was collapsing the 6 other releases. In the rush I just saw last release 3 months ago. 👍

@npinon
Copy link
Author

npinon commented Feb 24, 2014

Reopen.
There's a problem with the correction. You must reload a page to view images generated by the bundle (find vs findOne).
I solved the problem with this commit.

@peterrehm
Copy link
Contributor

@npinon What is the difference? Dont understand what you mean with reload.

@npinon
Copy link
Author

npinon commented Feb 24, 2014

@peterrehm find didn't return the correct objet (instead of findOne) but the cache image is generated. So when you load the page for the first time nothing is displayed, but when you reload the cache image is displayed.

@peterrehm
Copy link
Contributor

@npinon What is the difference? It should return the same object. It worked for me without any problems.

@npinon
Copy link
Author

npinon commented Feb 26, 2014

I'm sorry, I just checked and you're right.
I don't have the problem anymore. It's weird...

aldeck added a commit to upro/LiipImagineBundle that referenced this issue Jun 5, 2014
It seems that a previously proposed patch never made it into the repo (cf. issue liip#305)
aldeck added a commit to upro/LiipImagineBundle that referenced this issue Jun 5, 2014
It seems that a previously suggested patch never made it into the repo (cf. issue liip#305)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants