Zend Framework: Fill form with data from mapper -
An example of getting data from form using Mapper in official form.
something like that (Without using Mapper and DBTable):
Class NewsModel_form_newsZend_Form (private $ id = 0; public function getId () {return- $ this-> ID;} Public function set ID ($ id) {$ this-> id = $ id;} Public function init () {$ model = New Newsmodel_backend (); // If the form is required to add an action ($! - -> ID) {// Form Code} Other {// if editing form Fill with values) // Form with form form}}}
But with the mapper pattern this stuff should be more beautiful and cool, but I do not know That's how to do it.
So the question is how to populate the form with values using Mapper Pattern (for example, from Quick Start to Guest Book Entry)?
public function init () {$ model = new Newsmodel_backend (); $ This- & gt; Populate ($ model> toArray ()); ...
Comments
Post a Comment