1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
Fabio B. Silva 2012-03-15 22:38:54 -03:00
parent 36dc560533
commit 9cee329407
5 changed files with 15 additions and 11 deletions

View File

@ -33,8 +33,10 @@ class HydrationException extends \Doctrine\ORM\ORMException
*/
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias)
{
return new self("The discriminator column '$discrColumnName' "
. "is missing for '$entityName' using the DQL alias '$dqlAlias'.");
return new self(sprintf(
'The discriminator column "%s" is missing for "%s" using the DQL alias "%s".',
$discrColumnName, $entityName, $dqlAlias
));
}
/**
@ -46,7 +48,9 @@ class HydrationException extends \Doctrine\ORM\ORMException
*/
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias)
{
return new self("The meta mapping for the discriminator column '$discrColumnName' "
. "is missing for '$entityName' using the DQL alias '$dqlAlias'.");
return new self(sprintf(
'The meta mapping for the discriminator column "%s" is missing for "%s" using the DQL alias "%s".',
$discrColumnName, $entityName, $dqlAlias
));
}
}

View File

@ -218,13 +218,13 @@ class ObjectHydrator extends AbstractHydrator
if (isset($this->_rsm->discriminatorColumns[$dqlAlias])) {
if (!isset($this->_rsm->metaMappings[$this->_rsm->discriminatorColumns[$dqlAlias]])) {
if ( ! isset($this->_rsm->metaMappings[$this->_rsm->discriminatorColumns[$dqlAlias]])) {
throw HydrationException::missingDiscriminatorMetaMappingColumn($className, $this->_rsm->discriminatorColumns[$dqlAlias], $dqlAlias);
}
$discrColumn = $this->_rsm->metaMappings[$this->_rsm->discriminatorColumns[$dqlAlias]];
if (!isset($data[$discrColumn])) {
if ( ! isset($data[$discrColumn])) {
throw HydrationException::missingDiscriminatorColumn($className, $discrColumn, $dqlAlias);
}
@ -339,7 +339,7 @@ class ObjectHydrator extends AbstractHydrator
$path = $parentAlias . '.' . $dqlAlias;
// We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs
if (!isset($nonemptyComponents[$parentAlias])) {
if ( ! isset($nonemptyComponents[$parentAlias])) {
// TODO: Add special case code where we hydrate the right join objects into identity map at least
continue;
}

View File

@ -92,7 +92,7 @@ class SimpleObjectHydrator extends AbstractHydrator
if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
$discrColumnName = $this->_platform->getSQLResultCasing($this->class->discriminatorColumn['name']);
if (!isset($sqlResult[$discrColumnName])) {
if ( ! isset($sqlResult[$discrColumnName])) {
throw HydrationException::missingDiscriminatorColumn($entityName, $discrColumnName, key($this->_rsm->aliasMap));
}

View File

@ -1869,7 +1869,7 @@ class ObjectHydratorTest extends HydrationTestCase
* @group DDC-1470
*
* @expectedException \Doctrine\ORM\Internal\Hydration\HydrationException
* @expectedExceptionMessage The meta mapping for the discriminator column 'c_discr' is missing for 'Doctrine\Tests\Models\Company\CompanyFixContract' using the DQL alias 'c'.
* @expectedExceptionMessage The meta mapping for the discriminator column "c_discr" is missing for "Doctrine\Tests\Models\Company\CompanyFixContract" using the DQL alias "c".
*/
public function testMissingMetaMappingException()
{
@ -1897,7 +1897,7 @@ class ObjectHydratorTest extends HydrationTestCase
* @group DDC-1470
*
* @expectedException \Doctrine\ORM\Internal\Hydration\HydrationException
* @expectedExceptionMessage The discriminator column 'discr' is missing for 'Doctrine\Tests\Models\Company\CompanyEmployee' using the DQL alias 'e'.
* @expectedExceptionMessage The discriminator column "discr" is missing for "Doctrine\Tests\Models\Company\CompanyEmployee" using the DQL alias "e".
*/
public function testMissingDiscriminatorColumnException()
{

View File

@ -13,7 +13,7 @@ class SimpleObjectHydratorTest extends HydrationTestCase
* @group DDC-1470
*
* @expectedException \Doctrine\ORM\Internal\Hydration\HydrationException
* @expectedExceptionMessage The discriminator column 'discr' is missing for 'Doctrine\Tests\Models\Company\CompanyPerson' using the DQL alias 'p'.
* @expectedExceptionMessage The discriminator column "discr" is missing for "Doctrine\Tests\Models\Company\CompanyPerson" using the DQL alias "p".
*/
public function testMissingDiscriminatorColumnException()
{