zend framework - Create model instance in Form in ZF2 like ZF1? -


in zf1 possible create instance of model , access properties form class.`

class application_form_drydepot extends zend_form {       $model = new application_model_dbtable_drydepotmodel();      $list   = $model ->formationselect();      array_unshift($list, array('key'   => '', 'value' => '--please select--'));       $id = new zend_form_element_hidden('id');     $id->addfilter('int')             ->setdecorators($this->elementdecoration);       $formation = new zend_form_element_select('formation_id');     $formation->setlabel('formation name')             ->setrequired(true)             ->setattrib('id', 'formation')             ->setattrib('class', 'required')             ->addvalidator('notempty', true)             ->setmultioptions($list)             ->setdecorators($this->elementdecoration); } 

in here $model directly possible call use zf2 quite difficult. not successfull it. in zf2 how do same operation.

another ways here : the documentation

programmatic form creation

zf2 coding close zf1

use zend\captcha; use zend\form\element; use zend\form\form;  $captcha = new element\captcha('captcha'); $captcha     ->setcaptcha(new captcha\dumb())     ->setlabel('please verify human');  $form = new form('my-form'); $form->add($captcha); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -