From 8625ca5187c05dbf5b4bfb3b3725f7c806e0644a Mon Sep 17 00:00:00 2001
From: Iain Cambridge <icambridge@users.noreply.github.com>
Date: Wed, 20 May 2015 15:10:01 +0200
Subject: [PATCH] Allow null to be passed to setHydrationCacheProfile

Currently null can be passed and is set as default, however if you do this you get an exception. This allows null to be passed and set.

There is an if statement later on to see if $this->_hydrationCacheProfile is null so it seems logical you can set it to be null.
---
 lib/Doctrine/ORM/AbstractQuery.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php
index e1667add2..9612a0c58 100644
--- a/lib/Doctrine/ORM/AbstractQuery.php
+++ b/lib/Doctrine/ORM/AbstractQuery.php
@@ -502,7 +502,7 @@ abstract class AbstractQuery
      */
     public function setHydrationCacheProfile(QueryCacheProfile $profile = null)
     {
-        if ( ! $profile->getResultCacheDriver()) {
+        if ($profile !== null && ! $profile->getResultCacheDriver()) {
             $resultCacheDriver = $this->_em->getConfiguration()->getHydrationCacheImpl();
             $profile = $profile->setResultCacheDriver($resultCacheDriver);
         }