Using a form helper with PhpEngine as a standalone

I am going to use symfony form as a standalone component. I wonder how I can apply PhpEngine for rendering. In the official docs, this is only with Twig. I haven't found any examples on how to implement it.

composer
    "symfony/form": "2.7.*",
    "symfony/validator": "2.7.*",
    "symfony/config": "2.7.*",
    "symfony/templating": "2.8.*@dev",
    "symfony/twig-bridge": "3.0.*@dev",
    "symfony/framework-bundle": "2.7.0-BETA1"

      

so i do something like this:

in view:
<?php echo $view['form']->start($form) ?>
<?php echo $view['form']->widget($form) ?>
<?php echo $view['form']->end($form) ?>

 in controller:
  $this->phpEngine = new PhpEngine(new TemplateNameParser(), $this->loader);
  $this->phpEngine->render($this->template, $this->container);

      

Therefore, the renderer cannot find the FormView helper. it has no effect on ((By the way, the "symfony / templating" component has no FormHelper. After googling I found this FormHelper

$ this-> phpEngine-> setHelpers ([new SlotsHelper (), new FormHelper ($ this-> phpEngine)]);

+3


source to share





All Articles