点击updateAction()时init()没有触发

时间:2011-03-30 20:00:13

标签: zend-framework

我正在使用Zend Framework和ZendScaffolding来更快地生成我的管理部分。我在我的Controller中创建了一个updateAction函数,以便我可以执行其他操作,但是当我点击updateAction的网址时,init()永远不会触发。

我需要做些什么才能让init()再次开火?

这是我的代码:

class Admin_MakeController extends Zend_Controller_Scaffolding {

    public function init() {
        $this->initScaffolding(new Application_Model_Make(), array(
            'name' => array(
                'validators' => array(
                    /**
                         * This seems like a *very* akward way to do this, but it also seems correct,
                     * at least as far as ZendScaffold is concerned
                     */
                    array(
                        'db_NoRecordExists',
                        '',
                        array(
                            'table' => 'makes',
                            'field' => 'name',
                        ),
                    ),
                )
            ),
            'created_at' => array(
                'skip' => true, // don't show
            ),
        ));
    }

    public function updateAction() {
        if ($this->getRequest()->isPost()) {
            var_dump(func_get_args());
            exit;
        }
    }
}

编辑:抱歉,误导了。

0 个答案:

没有答案