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

Symfony 3 - You have requested a non-existent service "templating.helper.assets". #92

Closed
robbanl opened this issue Jan 2, 2016 · 11 comments

Comments

@robbanl
Copy link
Contributor

robbanl commented Jan 2, 2016

Hello,

I'm having some troubles using this bundle in my Symfony 3 application.

Tried using {{ image('/code/symfony/web/img/404.png').resize(100,100) }} in the twig template, but got the error:

Error: Method Gregwar\ImageBundle\ImageHandler::__toString() must not throw an exception

After some searches on Google I found that I should call jpeg() method to have a better error. Received this error:

An exception has been thrown during the rendering of a template ("You have requested a non-existent service "templating.helper.assets".") in AppBundle::default/frontpage.html.twig at line 13.

Also tried directly in the controller, $foo = $this->get('image.handling')->open('/code/symfony/web/img/404.png')->jpeg(); but got the same error.

Is it me who missed something or anything that changed in Symfony 3?

@robbanl robbanl changed the title Symfony 3 Symfony 3 - You have requested a non-existent service "templating.helper.assets". Jan 2, 2016
@robbanl
Copy link
Contributor Author

robbanl commented Jan 2, 2016

Of course, when I wrote it and did some more research I found the issue:

  • The templating.helper.assets was removed in Symfony 3.0. You should use the assets.package service instead.

Will create a pull request!

@robbanl
Copy link
Contributor Author

robbanl commented Jan 2, 2016

#91 already exists, but I think that will break SF2 versions... Hmmm...

@Gregwar
Copy link
Owner

Gregwar commented Jan 2, 2016

Could we simply test wether the services exist?

@Gregwar
Copy link
Owner

Gregwar commented Jan 2, 2016

Maybe something like $container->has('templating.helper.assets')

@robbanl
Copy link
Contributor Author

robbanl commented Jan 2, 2016

Sounds like a plan! I'll give it a try!

@robbanl
Copy link
Contributor Author

robbanl commented Jan 2, 2016

@Gregwar PR is ready when you are :)

@Gregwar Gregwar closed this as completed Jan 2, 2016
@MaZderMind
Copy link

@Gregwar would you mind pushing a release? Currently no released version of the ImageBundle is compatible with the current Symfony 3.x because of this issue.

@alexiswbr
Copy link

@Gregwar ping

@Gregwar
Copy link
Owner

Gregwar commented Aug 16, 2016

Tagged v2.0.23, is it OK?

@leperse
Copy link

leperse commented Sep 28, 2016

The templating.helper.assets service was replaced in Symfony 3.0.* by assets.packages

@Gregwar
Copy link
Owner

Gregwar commented Sep 29, 2016

@leperse yes, this is fixed in #93

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

5 participants