Did you manage to find a solution to this. I am having the exact same issue trying to implement with Twig. All I could glean is that when it tries to load the resource although the array key appears to be there it is empty and I am not sure what is supposed to be going inside the resource or where it gets set.
On Tuesday, August 21, 2012 5:52:40 PM UTC+1, amnotafraid wrote: > > I am having problems getting Symfony2 form to work standalone. I am > getting an error. I have collected some details about this and my post > is long. Please forgive. > > If anyone has any ideas about how I could get this working, please let me > know. > > *Details* > > I started with bschussek’s gist (https://gist.github.com/3256975 ) which > states “Symfony 2.1 stand-alone form usage with PHP templates”. > > To get it working, here are the steps I followed: > > 1.) Download the gist and extract. Place these three files in these > directories: > > composer.json . [root directory] > index.html.php views > index.php web > > 2.) I get composer.phar in the root directory and execute ‘php > composer.phar install’. (See Output from composer) > > 3.) In index.php, I replace $csrfSecret with my own value generated by > md5(uniqid(rand(), TRUE)); > > 4.) I display \web\index.php in a browser and get an error. (See Error) > > I am running PHP Version 5.3.8 > > I tried to debug it in NetBeans using Xdebug. See Debugging notes. > > *Error:* > > Fatal error: Uncaught exception > 'Symfony\Component\Form\Exception\FormException' with message 'Unable to > render the form as none of the following blocks exist: "_form_widget", > "form_widget".' in > C:\xampp\htdocs\FormTrial4\vendor\symfony\form\Symfony\Component\Form\FormRenderer.php > > on line *221* > > *Debugging notes:*** > > In > C:\xampp\htdocs\FormTrial4\vendor\symfony\form\Symfony\Component\Form\Extension\Templating > > \TemplatingRendererEngine.php: > > 57 protected function loadResourceForBlockName($cacheKey, FormView > $view, $blockName) > > 58 { > > 59 // Recursively try to find the block in the themes assigned to > $view, > > 60 // then of its parent form, then of the parent form of the > parent and so on. > > 61 // When the root form is reached in this recursion, also the > default > > 62 // themes are taken into account. > > 63 > > 64 // Check each theme whether it contains the searched block > > 65 if (isset($this->themes[$cacheKey])) { > > 66 for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; > --$i) { > > 67 if ($this->loadResourceFromTheme($cacheKey, $blockName, > $this->themes[$cacheKey][$i])) { > > 68 return true; > > 69 } > > 70 } > > 71 } > > 72 > > 73 // Check the default themes once we reach the root form without > success > > 74 if (!$view->parent) { > > 75 for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) { > > 76 if ($this->loadResourceFromTheme($cacheKey, $blockName, > $this->defaultThemes[$i])) { > > 77 return true; > > 78 } > > 79 } > > 80 } > > At line 65, these are the variable values: > > $cacheKey = "_form_form" > > $blockName = "_form_widget" > > The if statement is false and control passes to line 74. A call is made to > loadResourceFromTheme. These are the parameter values: > > $cacheKey = "_form_form" > > $blockName = "_form_widget" > > $i = 0 > > $this->defaultThemes[$i] = > "C:\xampp\htdocs\FormTrial4\vendor\symfony\framework-bundle\Symfony\Bundle\FrameworkBundle\Resources\views\Form" > > Stepping into the function, in > C:\xampp\htdocs\FormTrial4\vendor\symfony\form\Symfony\Component\Form\Extension\Templating\TemplatingRendererEngine.php: > > 115 protected function loadResourceFromTheme($cacheKey, $blockName, > $theme) > > 116 { > > 117 if ($this->engine->exists($templateName = $theme . ':' . > $blockName . '.html.php')) { > > 118 $this->resources[$cacheKey][$blockName] = $templateName; > > > > 119 return true; > > 120 } > > > > 121 return false; > > 122 } > > At line 117, these are the values of the variables: > > $cacheKey = "_form_form" > > $blockName = "_form_widget" > > $theme = "C: > > mpp\htdocs\FormTrial4 > endor\symfony > ramework-bundle\Symfony\Bundle\FrameworkBundle\Resources > iews\Form" > > So, the third parameter of this function appears to be getting over > written. This could be a bug with NetBeans and XDebug, but it does > correspond to what I see when it’s *not *under debug. Also, it could be > a compiler error. Hence, I have included my PHP version (5.3.8). Or, it > could be that my Symfony2 components are not compatible with each other. > Hence, > I have included info about what components I am using. > > *Output from composer:* > > C:\xampp\htdocs\FormTrial4>php composer.phar install > > Installing dependencies > > - Installing doctrine/common (2.3.x-dev) > > Cloning 2ec4bc6db13db6a0976a16b71058083c55cbcdbd > > > > - Installing symfony/options-resolver (dev-master) > > Cloning 6a1159eb868b3af059d0a8c578db1f7efab89850 > > > > - Installing symfony/locale (dev-master) > > Cloning 58ff3213b4e187f410d6795a1da11dfde8a0e118 > > > > - Installing symfony/event-dispatcher (dev-master) > > Cloning 76c76f62702b09e0f182ae618be0f1d79e2a711f > > > > - Installing symfony/form (dev-master) > > Cloning 74583bb7a8ed758c29431b4900467db04ddd0b32 > > > > - Installing symfony/validator (dev-master) > > Cloning 2794f1d7bfea5c017c50f870ca1bf2dd1c363f03 > > > > - Installing symfony/translation (dev-master) > > Cloning d7a6083e76a3af3f247bff523bc47b41e7208a87 > > > > - Installing symfony/templating (dev-master) > > Cloning v2.1.0-RC1 > > > > - Installing symfony/routing (dev-master) > > Cloning v2.1.0-RC1 > > > > - Installing symfony/filesystem (dev-master) > > Cloning 72acf65c2390c9066e1174d269a4e146ffad9296 > > > > - Installing symfony/http-foundation (dev-master) > > Cloning 8d5e7f909fa519853e71bcfc57a1da8c637ebcbb > > > > - Installing symfony/http-kernel (dev-master) > > Cloning 0d0ee371ab0425f3399dba9e25d7ad98ca5c0d62 > > > > - Installing symfony/config (dev-master) > > Cloning f68ad44f3ee1603ce96387bacba0ecba488c2a33 > > > > - Installing symfony/dependency-injection (dev-master) > > Cloning 98fa735a7ef5dc07c43bfe6faa4367a983b6ba6f > > > > - Installing symfony/framework-bundle (dev-master) > > Cloning 4f0d296b4414cb5322e7ee45af117e5234bc75d0 > > > > symfony/validator suggests installing symfony/yaml (dev-master) > > symfony/translation suggests installing symfony/yaml (dev-master) > > symfony/routing suggests installing symfony/yaml (dev-master) > > symfony/http-kernel suggests installing symfony/browser-kit (dev-master) > > symfony/http-kernel suggests installing symfony/class-loader (dev-master) > > symfony/http-kernel suggests installing symfony/console (dev-master) > > symfony/http-kernel suggests installing symfony/finder (dev-master) > > symfony/dependency-injection suggests installing symfony/yaml (dev-master) > > symfony/framework-bundle suggests installing symfony/console (dev-master) > > symfony/framework-bundle suggests installing symfony/finder (dev-master) > > Writing lock file > > Generating autoload files > > gist3256975-6c5ede69a9a07f3a09c3c32ee37543885a4c0f2a.tar.gz > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en