I am following along the Symfony 2 book chapter on forms (using
BETA1), and everything is working fine until I create the Form Class
ProductType:
// src/Acme/StoreBundle/Form/ProductType.php
namespace Acme\StoreBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
class ProductType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('name');
$builder->add('price', 'money', array('currency' => 'USD'));
}
public function getDefaultOptions(array $options)
{
return array(
'data_class' => 'Acme\StoreBundle\Entity\Product',
);
}
}
when I call this in the Controller
// src/Acme/StoreBundle/Controller/DefaultController.php
use Acme\StoreBundle\Form\ProductType;
public function indexAction()
{
$form = $this->get('form.factory')->create(new ProductType());
// ...
}
I get the following error:
Declaration of Acme\StoreBundle\Form\ProductType::buildForm() must be
compatible with that of Symfony\Component\Form
\FormTypeInterface::buildForm()
Any ideas ?
Thanks
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en