i was reading http://mwop.net/blog/2012-07-02-zf2-beta5-forms.html and working with that annotation builder in zf2 and doctrine without any problem
i wonder if i had a zend form class ... for example class bookForm ... how can i use this annotation builder inside the class
for example load basic fields from doctrine entity annotation then add some extra things (like submit button) inside the bookForm class ...
in mwop.net example it use within controller ... if I add my extra form fields in that controller would be too ugly..
use MyVendor\Model\User;
use Zend\Form\Annotation\AnnotationBuilder;
$user = new User();
$builder = new AnnotationBuilder();
$form = $builder->createForm($user);
$form->bind($user);
$form->setData($dataFromSomewhere);
if ($form->isValid()) {
// $user is now populated!
echo $form->username;
return;
} else {
// probably need to render the form now.
}
please help