Tue Vo
Tue Vo

Reputation: 323

Message: You have requested a non-existent service "http"

I have a problem with render tag in twig.

I got a message: "You have requested a non-existent service "http". When i use {% render url("render_menu") %}

render_menu route works fine

help me !

P/S: Sorry about my english

Upvotes: 2

Views: 1993

Answers (2)

Lionel Gaillard
Lionel Gaillard

Reputation: 3023

You use a correct way, but with an old version. You should upgrade to fix security issues AND resolve your problem.

A security issue changed the way to use render: http://symfony.com/blog/security-release-symfony-2-0-20-and-2-1-5-released

Documentation has been updated: http://symfony.com/doc/2.0/book/http_cache.html#using-edge-side-includes

Upvotes: 2

Vitalii Zurian
Vitalii Zurian

Reputation: 17976

You are using render tag wrong. If you want to render action, that is behind your render_menu - you should pass it in format YourBundle:YourController:YourAction.

For example, if you have menuAction() that is behind route render_menu, then in Twig you should call it like this:

{% render "YourBundle:YourController:menu" %}

Note, that you have to strip out Action word when calling menuAction in render tag.

Upvotes: 1

Related Questions