Hi,
Just doing some bits with Zend_App, In have two minor issues currently.
When creating a bootstrap file, it keeps bugging me about abstract
method unregisterPluginResource saying that it needs to be
implemented.
Also to get the bootstrap to call my init methods they have to be
public not protected, I have tracked this to:
$options = $application->getOptions();
$this->setOptions($options);
foreach (get_class_methods($this) as $method) {
if (5 < strlen($method) && '_init' === substr($method, 0, 5)) {
$this->_classResources[strtolower(substr($method, 5))]
= $method;
}
}
The get_class_methods($this) seems to only return public methods?
Seems maybe more a PHP bug than anything, the only bug I could find
associated with this was http://bugs.php.net/bug.php?id=43483. My PHP
version is 5.2.5.
My bootstrap:
class Bootstrap extends Zend_Application_Bootstrap_Base
{
public function _initFrontController()
{
$this->front = Zend_Controller_Front::getInstance();
}
// not called???
protected function _initControllers()
{
// runs _initFrontController() if not already run:
$this->bootstrapFrontController();
$this->front->addModuleDirectory(MODULE_PATH . '/modules');
}
// called!
public function _initRequest()
{
// runs _initFrontController() if not already run:
$this->bootstrapFrontController();
$this->request = new Zend_Controller_Request_Http;
$this->front->setRequest($this->request);
}
public function run()
{
$this->front->dispatch();
}
// had to add this????
public function unregisterPluginResource($resource){}
}
My setup:
$paths = array(
get_include_path(),
'../library',
'../library/Incu',
'../library/Zapp'
);
set_include_path(join(PATH_SEPARATOR, array_reverse($paths)));
defined('APPLICATION_PATH')
or define('APPLICATION_PATH', realpath(dirname(__FILE__) .
'/../application'));
defined('APPLICATION_ENV')
or define('APPLICATION_ENV', 'development');
require_once 'Zend/Application.php';
/**
* Now there are multiple ways to set up the application. Firstly, the way via
* options or Zend_Config:
*/
$application = new Zend_Application(APPLICATION_ENV, array(
'bootstrap' => APPLICATION_PATH . '/bootstrap/Bootstrap.php',
'autoloadernamespaces' => array('Zend', 'SF')
)
);
$application->bootstrap();
var_dump($application);
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------