Hi all, I need to pass a variable (root categories) from controller to a form creation so that inside the form, the category tree can be generated Something like this //controller.php $form - new Form_Search($rootCategoryId); //Form_Search function init() { $modelCategory = new Category(); $tree = $modelCategory->getTree($rootCategoryId); //now create a select form from the returned $tree and add it to the form //.... } I am facing a problem here: How to pass the $rootCategoryId to the Form creation. I don't want to have to define a "setRootCategoryId()" and "addCategorySelectBox" functions inside the form. It does not seem so smooth, architecturally... And as a more general question, is having a model inside a Form creation a good practice? What's the best way for Form to interact with the controller and model? Cheers & Thanks for any help Hoang, |
2009年3月5日星期四
[fw-mvc] how to pass params to a Zend_Form construction
订阅:
博文评论 (Atom)
没有评论:
发表评论