Error in createphp: Method "fullName" for object "Midgard\CreatePHP\Entity\Controller" does not exist in DbuConferenceBundle:Page:biography.html.twig at line 9

168 views
Skip to first unread message

Bruno Reis

unread,
Aug 12, 2014, 9:59:46 PM8/12/14
to symfony-...@googlegroups.com
Hi everyone, 

The learning curve is pretty steep here, but I still moving a little every day. Please help. 

I've created a new type and template. But, when I use createphp, it seems that the cmfMainContent is a Controller instead of my Biography object. Does anybody has a clue on why? 

Even if I use the same objetct in another place (a listing on other template), it works ok. 

The template, rdf-mapping and everything else seems very similar to the page template: 


{% extends "::base.html.twig" %}

{% block content %}

    <div id="content">
        <div class="pure-u">
            {% createphp cmfMainContent as="rdf" noautotag %}
            <div class="l-box" {{ createphp_attributes(rdf) }}>
                <h1 {{ createphp_attributes( rdf.fullName ) }}>{{ cmfMainContent.fullName }}</h1>
                <div id="main-content" {{ createphp_attributes(rdf.body) }}>{{ cmfMainContent.body|raw }}</div>
            </div>
            {% endcreatephp %}
        </div>
    </div>
{% endblock %}

<type
    xmlns:schema="http://schema.org/"
    xmlns:type="http://davidbu.ch/types/"
    typeof="type:biography"
>
    <children>
        <property property="schema:headline" identifier="fullname"/>
        <property property="schema:text" identifier="body" />
    </children>
</type>

Also pasting the exception trace: 

[1] Twig_Error_Runtime: Method "fullName" for object "Midgard\CreatePHP\Entity\Controller" does not exist in "DbuConferenceBundle:Page:biography.html.twig" at line 9
    at n/a
        in /var/www/sms/app/cache/dev/classes.php line 4528

    at Twig_Template->getAttribute(object(Controller), 'fullName')
        in /var/www/sms/app/cache/dev/twig/85/4f/77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c.php line 46

    at __TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c->block_content(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_header'), 'content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content'), 'footer' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_footer')))
        in /var/www/sms/app/cache/dev/classes.php line 4373

    at Twig_Template->displayBlock('content', array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_header'), 'content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content'), 'footer' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_footer')))
        in /var/www/sms/app/cache/dev/twig/9f/b2/516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de.php line 208

    at __TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de->doDisplay(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_header'), 'content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content'), 'footer' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_footer')))
        in /var/www/sms/app/cache/dev/classes.php line 4428

    at Twig_Template->displayWithErrorHandling(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('stylesheets' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_stylesheets'), 'header' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_header'), 'content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content'), 'footer' => array(object(__TwigTemplate_9fb2516888dd12616e575f48ab6c372cc0c2a7932f1849948e72d51c683dc1de), 'block_footer')))
        in /var/www/sms/app/cache/dev/classes.php line 4409

    at Twig_Template->display(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content')))
        in /var/www/sms/app/cache/dev/twig/85/4f/77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c.php line 24

    at __TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c->doDisplay(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content')))
        in /var/www/sms/app/cache/dev/classes.php line 4428

    at Twig_Template->displayWithErrorHandling(array('cmfMainContent' => object(Biography), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables), 'sonata_block' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_854f77096f681242370b37c75ef55e7a8ebce988e3dc5648071d8ba88bc8004c), 'block_content')))
        in /var/www/sms/app/cache/dev/classes.php line 4409

    at Twig_Template->display(array('cmfMainContent' => object(Biography)))
        in /var/www/sms/app/cache/dev/classes.php line 4416

    at Twig_Template->render(array('cmfMainContent' => object(Biography)))
        in /var/www/sms/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php line 53

    at Symfony\Bridge\Twig\TwigEngine->render('DbuConferenceBundle:Page:biography.html.twig', array('cmfMainContent' => object(Biography)))
        in /var/www/sms/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/TwigEngine.php line 83

    at Symfony\Bundle\TwigBundle\TwigEngine->render('DbuConferenceBundle:Page:biography.html.twig', array('cmfMainContent' => object(Biography)))
        in /var/www/sms/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php line 50

    at Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine->render('DbuConferenceBundle:Page:biography.html.twig', array('cmfMainContent' => object(Biography)))
        in /var/www/sms/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/ViewHandler.php line 370

    at FOS\RestBundle\View\ViewHandler->renderTemplate(object(View), 'html')
        in /var/www/sms/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/ViewHandler.php line 439

    at FOS\RestBundle\View\ViewHandler->initResponse(object(View), 'html')
        in /var/www/sms/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/ViewHandler.php line 418

    at FOS\RestBundle\View\ViewHandler->createResponse(object(View), object(Request), 'html')
        in /var/www/sms/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/ViewHandler.php line 311

    at FOS\RestBundle\View\ViewHandler->handle(object(View))
        in /var/www/sms/vendor/symfony-cmf/content-bundle/Symfony/Cmf/Bundle/ContentBundle/Controller/ContentController.php line 105

    at Symfony\Cmf\Bundle\ContentBundle\Controller\ContentController->renderResponse('DbuConferenceBundle:Page:biography.html.twig', array('cmfMainContent' => object(Biography)))
        in /var/www/sms/vendor/symfony-cmf/content-bundle/Symfony/Cmf/Bundle/ContentBundle/Controller/ContentController.php line 88

    at Symfony\Cmf\Bundle\ContentBundle\Controller\ContentController->indexAction(object(Request), object(Biography), 'DbuConferenceBundle:Page:biography.html.twig')
        in  line 

    at call_user_func_array(array(object(ContentController), 'indexAction'), array(object(Request), object(Biography), 'DbuConferenceBundle:Page:biography.html.twig'))
        in /var/www/sms/app/bootstrap.php.cache line 2872

    at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
        in /var/www/sms/app/bootstrap.php.cache line 2846

    at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
        in /var/www/sms/app/bootstrap.php.cache line 2975

    at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
        in /var/www/sms/app/bootstrap.php.cache line 2255

    at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
        in /var/www/sms/web/app_dev.php line 28

Lukas Kahwe Smith

unread,
Aug 13, 2014, 5:20:46 AM8/13/14
to symfony-...@googlegroups.com, Bruno Reis

On 13 Aug 2014, at 03:59, Bruno Reis <bruno....@gmail.com> wrote:

> Hi everyone,
>
> The learning curve is pretty steep here, but I still moving a little every day. Please help.
>
> I've created a new type and template. But, when I use createphp, it seems that the cmfMainContent is a Controller instead of my Biography object. Does anybody has a clue on why?

can you try cmfMainContent.fullname ie. not with fullName ?

regards,
Lukas Kahwe Smith
sm...@pooteeweet.org



signature.asc

David Buchmann

unread,
Aug 13, 2014, 5:53:50 AM8/13/14
to symfony-...@googlegroups.com
hi,

the thing you get when doing the createphp tag is indeed of the class in
the stack trace (its called controller, but has nothing to do with a
symfony controller).

i think your error is one of uppercase vs lowercase. does rdf.fullname work?

cheers,david
> --
> You received this message because you are subscribed to the Google
> Groups "symfony-cmf-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to symfony-cmf-us...@googlegroups.com
> <mailto:symfony-cmf-us...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch

Bruno Reis

unread,
Aug 13, 2014, 6:16:51 AM8/13/14
to symfony-...@googlegroups.com
"rdf.fullname" works fine. Thanks! 

"cmfMainContent.fullname" was not necessary, it is already working with correct case:
"cmfMainContent.fullName"

The issue was really on the createphp stuff. 

Thanks again. 



To unsubscribe from this group and stop receiving emails from it, send an email to symfony-cmf-us...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages