2009年3月2日星期一

Re: [fw-mvc] Proper use of Zend_Loader_Autoloader_Resource

One more question ;)

According to this

    public function initDefaultResourceTypes()
    {
        $basePath = $this->getBasePath();
        $this->addResourceTypes(array(
            'dbtable' => array(
                'namespace' => 'Model_DbTable',
                'path'      => 'models/DbTable',
            ),
            'form'    => array(
                'namespace' => 'Form',
                'path'      => 'forms',
            ),
            'model'   => array(
                'namespace' => 'Model',
                'path'      => 'models',
            ),
            'plugin'  => array(
                'namespace' => 'Plugin',
                'path'      => 'plugins',
            ),
            'api' => array(
                'namespace' => 'Api',
                'path'      => 'apis',
            ),
        ));
        $this->setDefaultResourceType('model');
    }

there are defined also plugins. What kind of plugins should be here ?

There are plans to add also filters and helpers for layout or views by default ?

Cristian


Matthew Weier O'Phinney wrote:
-- Cristian Bichis <contact@zftutorials.com> wrote (on Monday, 02 March 2009, 04:55 PM +0200):

Please remember that Zend_Application is yet to be approved, and that the prototype is under active development. For right now, the below is (with modifications) how you would go about doing things; however, with the final version of Zend_Application, it will likely be much easier.    
   protected function _initResources()    {        $this->bootstrapFrontController();              $loaders = array();              foreach ($this->front->getControllerDirectory() as $module  => $dir)        {            $loaders[$module] = new Zend_Application_Module_Autoloader(   array(                'namespace' => ucfirst($module).'_',                'basePath'  => dirname($dir),            ) );                      $loaders[$module]->addResourceType('Model',  'models', 'Model');     
 The above line is unnecessary -- Zend_Application_Module_Autoloader already defines the 'Model' resource.    
       }    }     
   


--  Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com

没有评论: