sonata-project/SonataDoctrineMongoDBAdminBundle

Unexpected "render" tag on Symfony 3.0

acrozes opened this issue ยท 6 comments

The error:
Unexpected "render" tag (expecting closing tag for the "if" tag defined near line 54) in SonataDoctrineMongoDBAdminBundle:Form:form_admin_fields.html.twig at line 54.

I don't find how to fix it ?

I think it has to do with the changes discussed in this post: http://symfony.com/blog/new-in-symfony-2-7-twig-as-a-first-class-citizen
More specifically this line:

Using Twig directly has some drawbacks: you cannot use some base controller class shortcuts (like render() or renderResponse())

So apparently the render function was part of the abstraction layer, which they removed in 2.7.
@acrozes since you closed the issue, did you find a fix?

I don't think this has anything to do with the post your linking to : it's about a tag in a twig template, not about the base controller shortcut. Plus, the post say the issue of render not being usable when using twig directly is supposed to be resolved soon.

Yes I suppose you are right, after reading the entire article more closely it says nothing about actual twig tags only accessing the service from the controller. I guess I jumped to a conclusion a bit too soon. OK then my quest continues. Will post a solution when I find one.

What's strange also is the error message, that says it was expecting the closing tag (and nothing else?), but maybe twig error messages are not so great in this instance.

@MelvinLoos
The fix: #154
but not yet merged :(

@acrozes , awesome thanks! I just happened to fix it in my own project and then I saw your update.