diff --git a/lib/Doctrine/ORM/Configuration.php b/lib/Doctrine/ORM/Configuration.php index 2e1b76d44..4abdafcc4 100644 --- a/lib/Doctrine/ORM/Configuration.php +++ b/lib/Doctrine/ORM/Configuration.php @@ -593,9 +593,9 @@ class Configuration extends \Doctrine\DBAL\Configuration */ public function setDefaultRepositoryClassName($className) { - $objectRepositoryClassName = 'Doctrine\Common\Persistence\ObjectRepository'; + $reflectionClass = new \ReflectionClass($className); - if ($className !== $objectRepositoryClassName && ! is_subclass_of($className, $objectRepositoryClassName)) { + if ( ! $reflectionClass->implementsInterface('Doctrine\Common\Persistence\ObjectRepository')) { throw ORMException::invalidEntityRepository($className); } diff --git a/lib/Doctrine/ORM/ORMException.php b/lib/Doctrine/ORM/ORMException.php index 9a91a955e..2776753c5 100644 --- a/lib/Doctrine/ORM/ORMException.php +++ b/lib/Doctrine/ORM/ORMException.php @@ -152,8 +152,7 @@ class ORMException extends Exception public static function invalidEntityRepository($className) { - return new self("Invalid repository class '".$className."'. ". - "it must be a Doctrine\\ORM\\EntityRepository."); + return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository."); } public static function missingIdentifierField($className, $fieldName) diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php index 4fadeb637..9b5a845b8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php @@ -528,7 +528,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase /** * @group DDC-753 * @expectedException Doctrine\ORM\ORMException - * @expectedExceptionMessage Invalid repository class 'Doctrine\Tests\Models\DDC753\DDC753InvalidRepository'. it must be a Doctrine\ORM\EntityRepository. + * @expectedExceptionMessage Invalid repository class 'Doctrine\Tests\Models\DDC753\DDC753InvalidRepository'. It must be a Doctrine\Common\Persistence\ObjectRepository. */ public function testSetDefaultRepositoryInvalidClassError() {