douxsey
douxsey

Reputation: 3209

symfony2 php engine templating render all files in a folder

I am using the standalone symfony form with php templating. I setup all , validated all forms normaly but when I try to render a form I got the following error :

 Fatal error: Uncaught Symfony\Component\Form\Exception\LogicException: No 
 block "form_widget_simple" found while rendering the form

I figured out why this : I must define all the form_* block to do this. In the framework they defined all this stuff in a directory ...Resources/view/Form I copied this file in my project and starting to extend them with that

<?php $view->render("...../symfony/Resources/views/Form/form_widget_simple.html.php",
                  array("form"=>$form)) 
?>

My page started to render some input but

Fatal error: Uncaught Symfony\Component\Form\Exception\LogicException: No block "widget_attributes" found while rendering the form.

So I am wondering how to render them all by default before trying to render my templates thanks.

UPDATE here is my template simply call the form_widget_simple

<html>
<head>
   <title>Standalone Form Component</title>
</head>
<body>
<form action="#" method="post">
    <?php $view->get("form")->block($form,"form_widget_simple"); ?>
    <input type="submit" />
</form>
</body>
</html>

here is the controller that call the template

<?php
   echo $templating->render('agent/test.php', array(
    'form' => $form->createView(),
  ));
 ?>

the full error

Fatal error: Uncaught Symfony\Component\Form\Exception\LogicException: No block "form_widget_simple" found while rendering the form.
in /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vendor/symfony/form/FormRenderer.php:100 
Stack trace: #0 /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vendor/symfony/templating/Helper/FormHelper.php(213):
Symfony\Component\Form\FormRenderer->renderBlock(Object(Symfony\Component\Form\FormView), 'form_widget_sim...', Array)
 #1 /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vue/agent/test.html.php(8): 
Symfony\Component\Templating\Helper\FormHelper->block(Object(Symfony\Component\Form\FormView), 'form_widget_sim...') 
#2 /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vendor/symfony/templating/PhpEngine.php(152): require('/mnt/1070E7B870...') 
#3 /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vendor/symfony/templating/PhpEngine.php(80): Symfony\Component\Templating\PhpEngine->evaluate() 
#4 /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/_RESSOURCES/php/commun.php(85): Symfony\Co in /mnt/1070E7B870E7A2A8/wamp/www/ingrmc/application/vendor/symfony/form/FormRenderer.php on line 100

Upvotes: 0

Views: 230

Answers (0)

Related Questions