From b48a010aacd2841010df38406a39b939f26a890c Mon Sep 17 00:00:00 2001 From: RJ Garcia Date: Tue, 21 Feb 2017 03:57:55 -0800 Subject: [PATCH] Fixing default caching bug introduced from #205 (#211) If you have memcached or redis extensions installed doctrine will try to automatically connect to one of them if no cache paramter is set when dev mode is off. Defaulting to the default driver to prevent that behavior from occuring. Signed-off-by: RJ Garcia --- src/EntityManagerFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/EntityManagerFactory.php b/src/EntityManagerFactory.php index cc7488af..80ed704b 100644 --- a/src/EntityManagerFactory.php +++ b/src/EntityManagerFactory.php @@ -2,6 +2,7 @@ namespace LaravelDoctrine\ORM; +use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Cache\Cache; use Doctrine\ORM\Cache\DefaultCacheFactory; use Doctrine\ORM\Configuration; @@ -92,9 +93,12 @@ public function __construct( */ public function create(array $settings = []) { + $defaultDriver = $this->config->get('doctrine.cache.default', 'array'); + $configuration = $this->setup->createConfiguration( array_get($settings, 'dev', false), - array_get($settings, 'proxies.path') + array_get($settings, 'proxies.path'), + $this->cache->driver($defaultDriver) ); $this->setMetadataDriver($settings, $configuration);