diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index a7b1c75ef..15cfc60ff 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -68,9 +68,9 @@ class MappingException extends \Doctrine\ORM\ORMException return new self("No mapping file found named '$fileName' for class '$entityName'."); } - public static function mappingNotFound($fieldName) + public static function mappingNotFound($className, $fieldName) { - return new self("No mapping found for field '$fieldName'."); + return new self("No mapping found for field '$fieldName' on class '$className'."); } public static function oneToManyRequiresMappedBy($fieldName) diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 3264519e8..f8425b42f 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -289,4 +289,15 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $cm->setIdentifier(array('name', 'username')); $this->assertTrue($cm->isIdentifierComposite); } + + /** + * @group DDC-944 + */ + public function testMappingNotFound() + { + $cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); + + $this->setExpectedException('Doctrine\ORM\Mapping\MappingException', "No mapping found for field 'foo' on class 'Doctrine\Tests\Models\CMS\CmsUser'."); + $cm->getFieldMapping('foo'); + } } \ No newline at end of file