English 中文(简体)
require_once missing doctrine zend framework
原标题:

I m integrating doctrine with Zend Framework. I ve hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for Zend_Application_Bootstrap_BootstrapAbstract. Has anyone hit this?

my cli-config.php

<?php

$classLoader = new DoctrineCommonClassLoader( App , __DIR__ . "/../application/models");
$classLoader->register();

$classLoader = new DoctrineCommonClassLoader( Cms , __DIR__ . "/../application/modules/cms-modules/models");
$classLoader->register();

$classLoader = new DoctrineCommonClassLoader( Proxies , __DIR__ . "/../application/models");
$classLoader->register();


$config = new DoctrineORMConfiguration();
$config->setMetadataCacheImpl(new DoctrineCommonCacheArrayCache);
$driverImpl = $config->newDefaultAnnotationDriver(array(
        __DIR__."/../application/models/App",
        __DIR__."/../application/modules/cms-modules/models/Cms"
        ));
$config->setMetadataDriverImpl($driverImpl);

$config->setProxyDir(__DIR__ .  /Proxies );
$config->setProxyNamespace( Proxies );


// Database connection information
$connectionOptions = array(
     driver  =>  pdo_mysql ,
     dbname  =>  bella ,
     user  =>  username ,
     password  =>  password ,
     unix_socket  =>  /Applications/MAMP/tmp/mysql/mysql.sock 
);

$em = DoctrineORMEntityManager::create($connectionOptions, $config);

$helperSet = new SymfonyComponentConsoleHelperHelperSet( array(
     db  => new DoctrineDBALToolsConsoleHelperConnectionHelper($em->getConnection()),
     em  => new DoctrineORMToolsConsoleHelperEntityManagerHelper($em)
));
最佳回答

Bootstrap class should extends the Bootstrap Abstract class.

class Bootstrap extends Zend_Application_Module_Bootstrap {
   //.....
}
问题回答

Zend_Application does not use require_once. It is one of the first packages in ZF 1.* that requires the Zend Autoloader.

Yep replacing the doctrine class loader with Zend s auto loader did the trick. I had to add the path to the namespaces directly to the php path using set_include_path. Is there a nicer way to do this? I see Doctrine s class loader allows you to specify both the path and namespace. Thanks for your help beberlei and Alex





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签