This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » get object path error in twig

get object path error in twig

get object path error in twig

Tuesday 24 February 2015 2:18:29 pm - 2 replies


i have problem with ez_urlalias

in my twig view i have this code:

{% <span>set </span>url_inside = content.getFieldValue(<span>'url_inside'</span>) %}
{% <span>set </span>urlInsideLocationId = render(controller( <span>"DefaultBundle:Helper:getUrlInside"</span>, {<span>"id"</span>: url_inside.destinationContentId})) %}
{{ path(<span>'ez_urlalias'</span>, {<span>'locationId'</span>:  urlInsideLocationId}) }}

when i'm use this code i get this error:

An exception has been thrown during the rendering of a template ("Invalid or Empty Node passed to getItem constructor."blunk.gif Emoticon in DefaultsBundle:helper:banners.html.twig at line 8.

line 8:

{{ path(<span>'ez_urlalias'</span>, {<span>'locationId'</span>:  urlInsideLocationId}) }}


{{ dump(urlInsidelocationId) }} returned me:
string '5569' (length=4) 


when i'm change urlInsidelocationId to 5569:

{% set url_inside = content.getFieldValue('url_inside') %}
{% set urlInsideLocationId = render(controller( "DefaultBundle:Helper:getUrlInside", {"id": url_inside.destinationContentId})) %}
{{ path('ez_urlalias', {'locationId':  '5569'}) }}

path give me good path - and code working good


what i'm doing wrong ?

Thursday 23 November 2017 9:37:15 am

I have a similar problem with:

 {{ render(controller("ez_content:viewContent", {
    'contentId': 620,
    'viewType': 'embed'
} )) }}


CRITICAL - Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Invalid or Empty Node passed to getItem constructor." )."

(620 is the ID of a content)

Community Project 2014.11

Modified on Thursday 23 November 2017 9:41:14 am by Rémy PHP

Thursday 23 November 2017 10:01:29 am

Ha no, nothing to see.
I have an override rule:

                        template: "ClientFrontEndBundle:embed:range.html.twig"
                        controller: "ClientFrontEndBundle:Range:rangeViewContentEmbed"
                            Identifier\ContentType: "range"

And in my controller I had:

 $contentService->loadContentByContentInfo( $contentId );

Instead of

 $contentService->loadContent( $contentId );

I would have appreciated an error message that indicates the error ...


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from