ZF-10543: Zend_Application_Resource_Db && Zend_Application_Resource_Cachemanager
Description
Setting cache for Zend_Db with CacheManager
resources.db.defaultMetadataCache = database
public function setDefaultMetadataCache($cache)
{
$metadataCache = null;
if (is_string($cache)) {
$bootstrap = $this->getBootstrap();
if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper
&& $bootstrap->hasPluginResource('CacheManager')
) {
$cacheManager = $bootstrap->bootstrap('CacheManager')
->getResource('CacheManager');
if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
$metadataCache = $cacheManager->getCache($cache);
}
}
} else if ($cache instanceof Zend_Cache_Core) {
$metadataCache = $cache;
}
if ($metadataCache instanceof Zend_Cache_Core) {
Zend_Db_Table::setDefaultMetadataCache($metadataCache);
}
return $this;
}
options in resources set before init() is called and $this->getBootstrap() returns null before init(), so first condition is useless.
rev 23076
Comments
Posted by Ramon Henrique Ornelas (ramon) on 2010-10-30T18:55:37.000+0000
Attached patch.
Forced the assignment of the object "bootstrap" in the start of the execution of the plugin resource.
Posted by Ramon Henrique Ornelas (ramon) on 2010-11-11T03:25:29.000+0000
Here a simple code reproduced:
Posted by Ramon Henrique Ornelas (ramon) on 2010-11-18T15:25:17.000+0000
Attach patch with new test.
Posted by Ramon Henrique Ornelas (ramon) on 2010-11-18T16:03:10.000+0000
Fixed in r23383 merged to release branch 1.11 r23384.