(Note: Latest Symfony code)
When I try validate a simple Form class I get the following error:
"Expected argument of type object or array, string given".
Form class:
class NotificationsForm extends Form
{
protected function configure()
{
$this->add(new ChoiceField('notify_new_friend', array(
'choices' => array(
'0' => '0',
'1' => '1',
),
)));
....
}
}
Mapping (validation) class:
class Notifications
{
/**
* @validation:Choice({0, 1})
* @var integer
*/
public $notify_new_friend;
...
}
Code in controller:
$notifications = new Notifications();
$form = new NotificationsForm('notifications', array(
'validator' => $this->get('validator'),
));
$form->bind($this->get('request'), $notifications);
if ($form->isValid()) {
}
Does anyone know how to solve this?
--
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 [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-devs?hl=en