In my application I have this weird error when testing only, I am not testing any classes in my Repo folder yet but have this:
Call to undefined method Application_Model_Cache::getInstance() in C:\wamp\www\truCrowd_dev\application\models\Repo\User.php on line 12
My user Repo is:
class Application_Model_Repo_User
{
private $_database;
private $_cache ;
public function __construct()
{
$this->_database = Application_Model_Database::getInstance();
$this->_cache = Application_Model_Cache::getInstance();
$this->_longCache = Application_Model_Cache::getInstance(604800);
}
My cache class is:
class Application_Model_Cache
{
public static function getInstance($_expiration = 7200)
{
$frontend= array(
'lifetime' => $_expiration,
'automatic_serialization' => true
);
$backend= array(
'cache_dir' => './cache/',
);
$cache = Zend_Cache::factory('Output',
'File',
$frontend,
$backend
);
return $cache;
}
}
My testing bootstrap is:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
I Have tried to change the Cache class by having to instantiate it but I get the same result...
My Database class has the exact structure but I haven`t gotten this in the past, now that I advanced in development I wanted to make tests and the error appeared
You should check whether Application_Model_Cache class is being mocked in any of your tests, and if the mock is not being used when calling the non existent method.
Related
I am a new user to zend framework and i tried the other solutions given in stack overflow for similar questions.
This is my index.php
<?php
date_default_timezone_set('UTC');
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
When i echo set_include_path, this is the response i got,
:.:/usr/lib64/php
Do i have to install zend framework in my new Cent OS ?
My library folder is, in the same directory the index.php reside.
/home/eat/public_html/index.php
/home/eat/public_html/library
/home/eat/public_html/library/Zend
Update..
When i hardcoded the path as, set_include_path('/home/eat/public_html/library/');
I started getting a new error. which is,
Warning: require_once(Zend/Loader/Autoloader.php): failed to open stream: No such file or directory in /home/eat/public_html/library/Zend/Application.php on line 80
Fatal error: require_once(): Failed opening required 'Zend/Loader/Autoloader.php' (include_path='/home/eat/public_html/library/') in /home/eat/public_html/library/Zend/Application.php on line 80
**Update 2**
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "multidb" not found' in /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php:691 Stack trace: #0 /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php(626): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('multidb') #1 /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php(583): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('multidb') #2 /home/eat/public_html/application/Bootstrap.php(58): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('multidb') #3 /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php(666): Bootstrap->_initApplication() #4 /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php(619): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('application') #5 /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php(583): Z in /home/eat/public_html/library/Zend/Application/Bootstrap/BootstrapAbstract.php on line 691
Application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
eat.application.base.url = "eat.com"
eat.application.admin.url = "admin.eat.com"
eat.application.api.url = "api.eat.com"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.prefixDefaultModule = "1"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
autoloaderNamespaces[] = "Eat_"
resources.modules = ""
phpSettings.date.timezone = "GMT"
eat.application.salt = "sd876fs89df";
resources.view[] =
resources.view.helperPath.Eat_View_Helper = APPLICATION_PATH "/../library/Eat/View/Helper"
;;; Databases
;;;;; Layouts
resources.layout.layoutPath = APPLICATION_PATH "/views/layouts"
resources.layout.layout = web/web
nexva.applicaiton.fileUploadDirectory = APPLICATION_PATH "/../files"
;;;; ReCaptcha ;;;;
recaptcha.private_key = 6LfL7rsSAAAAAKgtKWsMk4hmA2DSVq0ODcyJFRjs
recaptcha.public_key = 6LfL7rsSAAAAANiaZOQN7LOoCGAXh29rHTZPRoVa
[staging : production]
eat.application.base.url = "eat.com"
eat.application.admin.url = "admin.eat.com"
eat.application.api.url = "api.eat.com"
;;; Databases
resources.multidb.default.adapter = mysqli
resources.multidb.default.host = "localhost"
resources.multidb.default.username = "eat"
resources.multidb.default.password = "eat"
resources.multidb.default.dbname = "eat_main"
resources.multidb.default.default = true
[development : production]
eat.application.base.url = "eat.com"
eat.application.admin.url = "admin.eat.com"
eat.application.api.url = "api.eat.com"
;;; Databases
resources.multidb.default.adapter = mysqli
;resources.multidb.default.host = "192.168.1.253"
resources.multidb.default.host = "localhost"
resources.multidb.default.username = "eat"
resources.multidb.default.password = "eat"
resources.multidb.default.dbname = "eat_main"
resources.multidb.default.default = true
[development-alt : development]
Update 3
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function __construct($application)
{
parent::__construct($application);
}
protected function _initAutoload()
{
Zend_Controller_Action_HelperBroker::addPrefix('Eat_Controller_Action_Helper');
$autoloader = new Zend_Application_Module_Autoloader(
array(
'namespace' => '',
'basePath' => APPLICATION_PATH,
'resourceTypes' => array(
'form' => array(
'path' => 'forms',
'namespace' => 'Form',
),
'model' => array(
'path' => 'models',
'namespace' => 'Model',
),
)
)
);
return $autoloader;
}
protected function _initLayoutHelper()
{
$this->bootstrap('frontController');
$layout = Zend_Controller_Action_HelperBroker::addHelper(new Eat_Controller_Action_Helper_LayoutLoader());
}
protected function _initApplication()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
Zend_Registry::set("config", $config);
$locale = new Zend_Locale();
Zend_Registry::set('Zend_Locale', $locale);
//init DB connection
try {
$this->bootstrap('multidb');
$multiDb = $this->getPluginResource('multidb');
$db = $multiDb->getDb('default');
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$db->getConnection();
$db->getProfiler()->setEnabled(true);
Zend_Registry::set('db', $db);
//Just making everything UTF8. This is a hack, need to find the proper Zend way
$db = Zend_Registry::get('db');
$db->query('SET NAMES "utf8"')->execute();
} catch (Zend_Db_Adapter_Exception $e) {
die("Error connecting to database: " . $e->getMessage());
}
}
public function _initRoutes()
{
/*
$router = Zend_Controller_Front::getInstance()->getRouter();
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', APPLICATION_ENV);
$router->addConfig($config, 'resources');
$routes['featured'] = new Zend_Controller_Router_Route(
'featured/:id',
array('controller' => 'index', 'action' => 'featured', 'id' => null)
);
Zend_Controller_Front::getInstance()->getRouter()->addRoutes($routes);
*/
}
protected function _initLanguages()
{
}
//Initilaize zend ACL
public function _initAcl()
{
//Omit the process in CLI mode
if (php_sapi_name() != 'cli')
{
$helper = new Eat_Controller_Action_Helper_AclDefault();
$helper->setRoles();
$helper->setResources();
$helper->setPrivilages();
$helper->setAcl();
//Register the ACL plugin - Then it will be called automatically,whenever an acion is called
$this->bootstrap('frontController');
$frontController = Zend_Controller_Front::getInstance();
// $frontController->registerPlugin(new Eat_Plugin_Acl());
}
}
//Initialize error controller
public function _initErrorSwitcher()
{
$this->bootstrap('frontController');
$frontController = Zend_Controller_Front::getInstance();
$frontController->registerPlugin(new Eat_Plugin_ErrorControllerSwitcher());
}
protected function _initZFDebug()
{
// Enabling this method seems to break autocomplete. Use only when needed
$autoloader = Zend_Loader_Autoloader::getInstance ();
$autoloader->registerNamespace ( 'ZFDebug' );
$db = Zend_Registry::get ( 'db' );
$cache = Zend_Cache::factory ( 'Core', 'File' );
//Zend_Controller_Front::getInstance()->getBaseUrl();
//APPLICATION_PATH
$options = array ('plugins' => array ('Variables', 'Database' => array ('adapter' => $db ), 'File' => array ('basePath' => Zend_Controller_Front::getInstance ()->getBaseUrl () ), 'Memory', 'Time', 'Registry', 'Cache' => array ('backend' => $cache->getBackend () ), 'Exception' ) );
$debug = new ZFDebug_Controller_Plugin_Debug ( $options );
$this->bootstrap ( 'frontController' );
$frontController = $this->getResource ( 'frontController' );
//$frontController->registerPlugin ( $debug );
}
}
your application & library folder should be located outside of public_html:
this code looks for "application" folder in parent("/../") folder (relative to index.php):
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
This code adds "/../library" to include path:
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/library'),
get_include_path(),
)));
So either move application & library folders outside of public_html, or remove /.. from the APPLICATOIN_PATH define (but this is undesirable as it will make your app less secure)
UPD. if you still get the error, make sure you have this file along with other Zend files:
library/Zend/Loader/Autoloader.php
If not, please download latest version of Zend Framework:
ZF1:
http://downloads.zend.com/framework/1.12.10/ZendFramework-1.12.10.tar.gz
ZF2:
http://downloads.zend.com/framework/2.3.4/ZendFramework-2.3.4.tgz
You can either save it to "library" folder or unarchive it to /usr/lib64/php (so it's saved as /usr/lib64/php/Zend/), this way you won't need to have this folder for each project
UPD2 search for
getResource('multidb')
in your code (application folder), then try to add
$this->bootstrap('multidb');
above that..
My guess is that either your Zend Framework version is different from used in original software, or your directory structure is invalid, could you try to move library&application folders outside of public_html?
UPD3 you can also drop me an email (mstrokin at gmail.com) and I'll try to fix that for you, I love debugging :)
UPD4 try to change "getPluginResource" to "getResource"
A possible issue would be permissions for the "library" directory.
And it affects Linux users in most cases.
If you are Linux user you may need to change them
sudo chmod 755 -R path_to_project/library
If you still experience that error then you should play around with either php.ini settings or the "library" folder location.
Hi everyone i'm trying to create a rest service using the zend framework
I have basicly copied the actual app that this rest service is going to be for.
i removed the layout folder and the view folders.
My problem is the modules don't seem to be loading at all and i get the following output when i go to the index.php
problemInvalid controller specified (error)#0 /home/********/*****/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/********/*****/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #2 /home/********/*****/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #3 /home/********/public_html/portal/websvc/index.php(34): Zend_Application->run() #4 {main}
I'm not sure why this isnt working. its basicly the same settings as my original app that has 20 modules and there is no problem with that.
PLEASE HELP! :'(
so i basicly have the following folder structure
/app/modules
/app/modules/v1
/app/modules/v1/controllers
/app/modules/v1/controllers/OutboundController.php
/app/modules/v1/controllers/ProductController.php
/app/modules/v1/Bootstrap.php
/app/modules/default
/app/modules/default/controllers
/app/modules/default/controllers/errorController.php
/app/config/
This is my application.ini
[production]
includePaths.library = APPLICATION_PATH "/../../../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.defaultModule = "v1"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirectoryName = "controllers"
resources.router.routes.rest.type = Zend_Rest_Route
My bootstrap.php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initautoloader() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'basePath' => APPLICATION_PATH."/modules/default",
'namespace' => '',
));
$resourceAutoLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => APPLICATION_PATH,
'namespace' => '',
));
$resourceAutoLoader->addResourceTypes(array(
"class" => array(
'namespace' => 'Class',
'path' => '/../../../library/Class'
),
"model" => array(
'namespace' => 'Model',
'path' => '/../../../library/Models'
)
));
}
protected function _initFrontModules()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$front->addModuleDirectory(APPLICATION_PATH . '/modules');
}
}
My index.php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../ibwms/applications/external/websvc'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../../library'),
get_include_path(),
)));
/* Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
try{
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
Zend_Controller_Front::getInstance()->setBaseUrl('/portal/websvc/');
$application->bootstrap()
->run();
}catch(Exception $e)
{
echo 'problem'.$e->getMessage();
}
Rename
/app/modules/default/controllers/errorController.php
to
/app/modules/default/controllers/ErrorController.php
Most likely there's an exception and application is trying to display it, but is unable to load the ErrorController
i am using Zend Framework classes in my CORE PHP project.
i am not using all features of ZF just need some classes.
i need to know How to include all Zend Classes at once so that i don't include it one by one each time i need it.
in ZF we are doing so
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
public function _initRegisterLibraries(){
$moduleLoader = new Zend_Application_Module_Autoloader(array('namespace' => '', 'basePath' => APPLICATION_PATH));
$autoLoader = Zend_Loader_Autoloader::getInstance();
return $moduleLoader;
}
how can we achieve same in CORE PHP in which i want to use some zend classes.
For me I do this in any PHP File :
define('WWW_PATH', dirname(__FILE__) . '/../..');
set_include_path(implode(PATH_SEPARATOR, array(realpath(WWW_PATH . '/library'), get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Zend_');
Then I can instantiate any Zend class I want, for exemple :
$db = new Zend_Db_Adapter_Mysql();
(Just be sure the WWW_PATH point to were the library directory is currently in)
I am working with Zend_Test. Below is my tests/bootstrap.php file:
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', 'testing');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Ca_');
Zend_Controller_Action_HelperBroker::addPrefix('Ca_Controller_Action_Helper');
$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'namespace' => "Social",
'basePath' => APPLICATION_PATH . "/../library",
));
$resourceLoader->addResourceType('facebook', 'Facebook/', 'Facebook');
This is my setUp() method in my test class (which is extending Zend_Test_PHPUnit_DatabaseTestCase):
public function setUp()
{
$this->bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$this->entityUser = new Ca_Model_Entity_User_Registered();
$a = $this->getAdapter();
$a->setFetchMode(Zend_Db::FETCH_OBJ);
$a->query("SET FOREIGN_KEY_CHECKS=0;");
parent::setUp();
}
Now, when running a unit test I get the following error for this particular line of code:
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$options = $bootstrap->getOptions();
Fatal error: Call to a member function getOptions() on a non-object
Does anyone know what is causing the issue and how I can resolve it ?
Thanks.
It looks like your code is treating a single parameter as an object.
From the docs at: http://framework.zend.com/manual/en/zend.controller.front.html
getParam($name) allows you to retrieve a single parameter
at a time, using $name as the identifier.
I fixed it. Ended up loading the application config in bootstrap and storing it in Zend_Registry. Much easier that way.
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
Zend_Registry::set('config', $config);
how can i get started with Doctrine 2 + ZF? any tutorials or resources?
on a side note, i hear ZF2 will use Doctrine as its models, true?
What's nice about working with ZF and Doctrine 2 is that there's very little that needs to be done to integrate them. Essentially, you just need access to an instance of Doctrine 2's EntityManager that's set up during the applications bootstrap, as well as make sure the Doctrine namespaces are getting loaded in your index.php (You'll need to use Doctrine's ClassLoader for this, Zend_Loader does not support namespaces yet).
You can instantiate your EntityManager manually in the bootstrap, or even easier, through a Resource Plugin (which makes it easy to store the database config in application.ini). You can pretty much follow the documentation on configuring and obtaining an Entity Manager in Doctrine's manual, and just have the init() method in your bootstrap resource return the instance.
You're probably going to want to depend highly on dependency injection for passing the EM to the various objects that need it. For an easy way to pass bootstrap resources into your action controllers, see this article on creating a simple resource injector.
I've been using Doctrine 2 with ZF since it's been in alpha, and have found it quite pleasant to work with.
I can give you some examples from the bootstrap.php I use:
public function _initDoctrine() {
if(PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3) {
require_once('bootstrapDoctrine.inc.php');
//things below this line are for convenience
require_once(dirname(__FILE__).'/../library/doctrinehelpers/requireEntitiesOnce.php');
Zend_Registry::set('doctrineEm', $em);
return $em;
}
}
And in the boostrapDoctrine.inc.php I have this:
use Doctrine\Common\ClassLoader,
Doctrine\ORM\Configuration,
Doctrine\ORM\EntityManager,
Doctrine\Common\Cache\ArrayCache,
Doctrine\DBAL\Logging\EchoSQLLogger;
require_once(realpath(APPLICATION_PATH . '/../library').'/doctrine2/lib/Doctrine/Common/ClassLoader.php');
$doctrineClassLoader = new ClassLoader('Doctrine', realpath(APPLICATION_PATH . '/../library').'/doctrine2/lib');
$doctrineClassLoader->register();
//no way to have your proxies generated in different directory per ZF module it seems so we use a global one
$proxiesClassLoader = new ClassLoader('Proxies', realpath(APPLICATION_PATH . '/models/doctrineproxies'));
$proxiesClassLoader->register();
/*
* #TODO make this step iterate over available modules
*/
$driverImpl = $config->newDefaultAnnotationDriver(array(APPLICATION_PATH . '/modules/mymodule1/models/doctrineentities',APPLICATION_PATH . '/modules/mymodule2/models/doctrineentities'));
$config->setMetadataDriverImpl($driverImpl);
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
// Proxy configuration
$config->setProxyDir(realpath(APPLICATION_PATH . '/models/doctrineproxies'));
$config->setProxyNamespace('Proxies');
/**
* this SQL logger is golden
* #TODO implement a switch for verbose debugging
*/
// $logger = new Doctrine\DBAL\Logging\DebugStack();
// $config->setSQLLogger($logger);
// register_shutdown_function(function($logger) {
// echo '<pre>';
// print_r($logger->queries);
// }, $logger);
$config->setAutoGenerateProxyClasses( true ); //disable in production environment
$doctrineConfig = $this->getOption('resources'); //from ini
$dbparams = $doctrineConfig['db']['params'];
$connectionOptions = array(
'driver' => $doctrineConfig['db']['adapter'],
'user' => $dbparams['username'],
'password' => $dbparams['password'],
'dbname' => $dbparams['dbname'],
'host' => $dbparams['host']
);
$em = EntityManager::create($connectionOptions, $config); //stored in zend registry later
To allow the doctrine commandline tool to function I had to create a library/doctrine2/lib/cli-config.php which is also a stripped down zend framework bootstrap. This config has the disadvantage that I have to call the doctrine cli from within this directory. Works for me ;)
/*
* #TODO make the cli-tool more flexible by better path detection
*/
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . '/../../include'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$ application->getBootstrap()->bootstrap('doctrine');
$em = $application->getBootstrap()->getResource('doctrine');
/*
$configuration = new \Doctrine\Common\Cli\Configuration();
$configuration->setAttribute('em', $em);
*/
$helperSet = new \Symfony\Components\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
Now we are all hoping for a better doctrine integration but this will only happen in ZF 2 going a big step towards namespaces like doctrine did allready.
Hope I could help.