Skip to content

Instantly share code, notes, and snippets.

@dlsniper
Created March 8, 2012 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlsniper/2003670 to your computer and use it in GitHub Desktop.
Save dlsniper/2003670 to your computer and use it in GitHub Desktop.
Configuration caching issue
/**
* Gets the 'doctrine.orm.default_entity_manager' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Doctrine\ORM\EntityManager A Doctrine\ORM\EntityManager instance.
*/
protected function getDoctrine_Orm_DefaultEntityManagerService()
{
$a = $this->get('doctrine.orm.default_memcached_instance');
$b = new \Doctrine\Common\Cache\MemcachedCache();
$b->setMemcached($a);
$b->setNamespace('sf2orm_default_7a317024065549248ec3c7187ecf2f84');
$c = new \Doctrine\Common\Cache\MemcachedCache();
$c->setMemcached($a);
$c->setNamespace('sf2orm_default_7a317024065549248ec3c7187ecf2f84');
$d = new \Doctrine\Common\Cache\MemcachedCache();
$d->setMemcached($a);
$d->setNamespace('sf2orm_default_7a317024065549248ec3c7187ecf2f84');
$e = new \Doctrine\ORM\Mapping\Driver\DriverChain();
$e->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/var/www/ss/src/Acme/DemoBundle/Entity')), 'Acme\\DemoBundle\\Entity');
$f = new \Doctrine\ORM\Configuration();
$f->setEntityNamespaces(array('AcmeDemoBundle' => 'Acme\\DemoBundle\\Entity'));
$f->setMetadataCacheImpl($b);
$f->setQueryCacheImpl($c);
$f->setResultCacheImpl($d);
$f->setMetadataDriverImpl($e);
$f->setProxyDir('/var/www/ss/app/cache/dev/doctrine/orm/Proxies');
$f->setProxyNamespace('Proxies');
$f->setAutoGenerateProxyClasses(false);
$f->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory');
return $this->services['doctrine.orm.default_entity_manager'] = call_user_func(array('Doctrine\\ORM\\EntityManager', 'create'), $this->get('doctrine.dbal.default_connection'), $f);
}
/**
* Gets the 'doctrine.orm.default_memcached_instance' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Memcached A Memcached instance.
*/
protected function getDoctrine_Orm_DefaultMemcachedInstanceService()
{
$this->services['doctrine.orm.default_memcached_instance'] = $instance = new \Memcached();
$instance->addServer('127.0.0.1', 11532);
return $instance;
}
/**
* Gets the 'doctrine.orm.stock_entity_manager' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Doctrine\ORM\EntityManager A Doctrine\ORM\EntityManager instance.
*/
protected function getDoctrine_Orm_StockEntityManagerService()
{
$a = $this->get('doctrine.orm.stock_memcached_instance');
$b = new \Doctrine\Common\Cache\MemcachedCache();
$b->setMemcached($a);
$b->setNamespace('sf2orm_stock_7a317024065549248ec3c7187ecf2f84');
$c = new \Doctrine\Common\Cache\MemcachedCache();
$c->setMemcached($a);
$c->setNamespace('sf2orm_stock_7a317024065549248ec3c7187ecf2f84');
$d = new \Doctrine\Common\Cache\MemcachedCache();
$d->setMemcached($a);
$d->setNamespace('sf2orm_stock_7a317024065549248ec3c7187ecf2f84');
$e = new \Doctrine\ORM\Mapping\Driver\DriverChain();
$e->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/var/www/ss/src/Acme/Demo2Bundle/Entity')), 'Acme\\Demo2Bundle\\Entity');
$f = new \Doctrine\ORM\Configuration();
$f->setEntityNamespaces(array('AcmeDemo2Bundle' => 'Acme\\Demo2Bundle\\Entity'));
$f->setMetadataCacheImpl($b);
$f->setQueryCacheImpl($c);
$f->setResultCacheImpl($d);
$f->setMetadataDriverImpl($e);
$f->setProxyDir('/var/www/ss/app/cache/dev/doctrine/orm/Proxies');
$f->setProxyNamespace('Proxies');
$f->setAutoGenerateProxyClasses(false);
$f->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory');
return $this->services['doctrine.orm.stock_entity_manager'] = call_user_func(array('Doctrine\\ORM\\EntityManager', 'create'), $this->get('doctrine.dbal.stock_connection'), $f);
}
/**
* Gets the 'doctrine.orm.stock_memcached_instance' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Memcached A Memcached instance.
*/
protected function getDoctrine_Orm_StockMemcachedInstanceService()
{
$this->services['doctrine.orm.stock_memcached_instance'] = $instance = new \Memcached();
$instance->addServer('127.0.0.1', 11532);
return $instance;
}
# Doctrine Configuration
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database_driver%
dbname: alert
user: %database_user%
password: %database_password%
host: %database_host%
charset: UTF8
stock:
driver: %database_driver%
dbname: stock
user: %database_user%
password: %database_password%
host: %database_host%
charset: UTF8
orm:
default_entity_manager: default
entity_managers:
default:
mappings:
AcmeDemoBundle: ~
metadata_cache_driver:
type: memcached
host: 127.0.0.1
port: 11531
query_cache_driver:
type: memcached
host: 127.0.0.1
port: 11532
result_cache_driver:
type: memcached
host: 127.0.0.1
port: 11533
connection: default
stock:
mappings:
AcmeDemo2Bundle: ~
metadata_cache_driver:
type: memcached
host: 127.0.0.1
port: 11531
query_cache_driver:
type: memcached
host: 127.0.0.1
port: 11532
result_cache_driver:
type: memcached
host: 127.0.0.1
port: 11533
connection: stock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment