From 84477440b6bc32515731ff4b2444362a413e5099 Mon Sep 17 00:00:00 2001 From: Jeremy Marc Date: Sun, 4 Nov 2012 17:41:08 -0800 Subject: [PATCH 1/2] Allow 0 id for Entity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using a 0 id, it's throwing InvalidArgumentException (Binding entities to query parameters only allowed for entities that have an identifier.)  --- 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 a12336035..ecc7dbca1 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -281,7 +281,7 @@ abstract class AbstractQuery $value = $values[$class->getSingleIdentifierFieldName()]; - if ( ! $value) { + if ( ! isset($value)) { throw new \InvalidArgumentException( "Binding entities to query parameters only allowed for entities that have an identifier." ); From 26dd533662c6a40fe1f04108379c02973833c20e Mon Sep 17 00:00:00 2001 From: Jeremy Marc Date: Sun, 4 Nov 2012 19:04:13 -0800 Subject: [PATCH 2/2] Compare to null instead of using isset --- 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 ecc7dbca1..0913b73f4 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -281,7 +281,7 @@ abstract class AbstractQuery $value = $values[$class->getSingleIdentifierFieldName()]; - if ( ! isset($value)) { + if (null === $value) { throw new \InvalidArgumentException( "Binding entities to query parameters only allowed for entities that have an identifier." );