Fixed is_subclass_of comparing an interface which brought our requirement to 5.3.9. Changed to reflection approach which still keep us at the same dependency as before.
This commit is contained in:
parent
1eaa822d2a
commit
04e6cc78cd
@ -593,9 +593,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
|||||||
*/
|
*/
|
||||||
public function setDefaultRepositoryClassName($className)
|
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);
|
throw ORMException::invalidEntityRepository($className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,7 @@ class ORMException extends Exception
|
|||||||
|
|
||||||
public static function invalidEntityRepository($className)
|
public static function invalidEntityRepository($className)
|
||||||
{
|
{
|
||||||
return new self("Invalid repository class '".$className."'. ".
|
return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository.");
|
||||||
"it must be a Doctrine\\ORM\\EntityRepository.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function missingIdentifierField($className, $fieldName)
|
public static function missingIdentifierField($className, $fieldName)
|
||||||
|
@ -528,7 +528,7 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
/**
|
/**
|
||||||
* @group DDC-753
|
* @group DDC-753
|
||||||
* @expectedException Doctrine\ORM\ORMException
|
* @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()
|
public function testSetDefaultRepositoryInvalidClassError()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user