2009年2月28日星期六

Re: [fw-mvc] Proper use of Zend_Loader_Autoloader_Resource

Hi,

Ok, i put up a sample based on http://framework.zend.com/wiki/display/ZFPROP/Zend_Application+-+Ben+Scholzen

I don't get the error i encountered before, but i get a new one.

//index.php
<?php
    if( !defined('APPLICATION_ENVIRONMENT'))
        define('APPLICATION_ENVIRONMENT', 'production');
       
    define('PUBLIC_PATH', realpath(dirname(__FILE__)));
    define('BASE_PATH', realpath(dirname(dirname(__FILE__))));
    define('APPLICATION_PATH', BASE_PATH . '/application');
    define('MODULE_PATH', APPLICATION_PATH . '/modules');
   
    set_include_path(
        BASE_PATH . '/library/dasprid' . PATH_SEPARATOR
        .BASE_PATH . '/library/incubator' . PATH_SEPARATOR
        .BASE_PATH . '/library' . PATH_SEPARATOR
        . get_include_path()
    );
   
    require 'Zend/Application.php';
   
    $application = new Zend_Application(APPLICATION_ENVIRONMENT, array(
        'autoloaderNamespaces' => array(
            'Imagis',
        ),
        'bootstrap' => APPLICATION_PATH . '/Bootstrap.php'
    ));
   
    $application->bootstrap();
     
    Zend_Controller_Front::getInstance()->dispatch();
?>

//Bootstrap.php based on http://framework.zend.com/wiki/display/ZFPROP/Zend_Application+-+Ben+Scholzen
<?php

require_once 'Zend/Application/Bootstrap/Base.php';

class Bootstrap extends Zend_Application_Bootstrap_Base
{
    public $front;
 
    public function init()
    {
        $this->front = Zend_Controller_Front::getInstance();
    }
 
    public function run()
    {
        $this->front->dispatch();
    }
 
    protected function _initControllers()
    {
        //$this->front->setControllerDirectory(APPLICATION_PATH . '/controllers', 'default');
        $this->front->addModuleDirectory(MODULE_PATH . '/modules');
        return $this;
    }
 
    protected function _initRequest()
    {
        $this->request = new Zend_Controller_Request_Http;
        $this->front->setRequest($this->request);
        return $this;
    }
}


And the error is: Fatal error: Call to a member function addModuleDirectory() on a non-object in D:\_Work\site\application\Bootstrap.php on line 22


Might be something i configured incorrectly.

Cristian



Matthew Weier O'Phinney wrote:
-- Cristian Bichis <contact@zftutorials.com> wrote (on Friday, 27 February 2009, 11:11 PM +0200):   
Matthew Weier O'Phinney wrote:      However, I've just gone through and cleaned up all the resources to     ensure that the require_once calls are removed and that they are     appropriately declaring their dependencies, so next time you try, you     should not have these issues.        Hmmm... based on your error, I think you had an outdated checkout.  Actually require_once was from my code not Zend code.  The required classes are not developed yet as far as i know. I just checked on SVN and no, there are not in yet. Also the #zftalk log is confirming what i said...     
 Unfortunately, I'm not logged in to IRC at this time. I'm modifying the QuickStart to use Zend_Application right now, and having no issues. Can you, or someone else, give an example of how you're using Zend_Application, and what errors you're running into?    


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

没有评论: