There is obviously a problem with the service definition. I did not look deeper in it though because it worked by using the FormFactroy class in the controller. And I did not need this form as a service necessarily.
On May 31, 2:40 pm, Sebastian <sknu...@googlemail.com> wrote: > Hi there, > > so I created a project using Symfony2Project. > In my controller I am creating a form using a service. > > Service definition: > > form.search_form: > class: MyNs\MyBundle\Form\SearchForm > > form.stock_search: > class: Symfony\Component\Form\Form > factory_service: form.factory > factory_method: create > arguments: > - "@form.search_form" > > Form definition: > > namespace MyNs\MyBundle\Form; > > use Symfony\Component\Form\AbstractType; > use Symfony\Component\Form\FormBuilder; > > class SearchForm extends AbstractType > { > public function buildForm(FormBuilder $builder, array $options) > { > $builder->add('term', 'text', array( > 'required' => true > )); > } > > } > > In the controller: > $searchForm = $this->get('form.search_form'); > > It works fine, but when I try to call $searchForm->createView > according to the documentation (http://symfony.com/doc/2.0/book/ > forms.html), I get an error, because the createView method obviously > doesn't exist in Symfony\Component\Form\AbstractType (anymore): > > Fatal error: Call to undefined method MyNs\MxBundle\Form > \SearchForm::createView() > > How do I actually get the view? -- 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 users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en