Hi ben,
WildFoxMedia a écrit :
Hey guys, im new to Zend, ive been a long time user of Cake, I have a few
questions related to conventions, etc.
1. Can someone possibly post a bootstrap/index file for a modular file
convention where there are seperate controllers/views for public and admin
modules that share models?
So far I have tried 2 solutions
1) 2 bootstraps index who share the same bootstrap class and rely on
Acl to isolate admin controller
/public/index.php and /public/admin/index.php
2) A backend directory to isolate admin controller and view
/modules
/articles
/controllers
/ArticleController.php
/models
/views
/backend
/controllers
/IndexController.php
/views
then detect in your bootstrap if you are in admin mode and if so do:
$this->_front->setModuleControllerDirectoryName('backend/controllers');
2. Is there a 'magic' save() method for saving to the database? I see
currently there is Insert & Update, I dont mind using insert & update, was
just curious.
3. Is there any kind of table inflection when you insert or update? What I
mean is if you have a table with 2 columns, id & name the array I try to
insert has 3 array keys for id, name & created it throws an error - Cake
does table inflection where it only attempts to save columns that exist in
the table.
see http://framework.zend.com/issues/browse/ZF-2243
4. Is there any decent way to autoload models instead of doing....
$this->someModel = new someModel; in the init() of every controller?
5. Whats the correct method for gathering the filtered data from a
controller, I saw in a tutorial where you basically check if the request is
a post, then you assign the POST array to a variable, then you loop through
each array key and do getValue() from the Form object...like this...
$formModel = new FormModel;
$dbRow = array();
foreach($postArray as $pKey => $pValue) {
$dbRow[$pKey] = $formModel->getValue($pKey);
}
Is that the best way?
Thank you
Regards,
--
Laurent Melmoux