commit
f6d9344d89
@ -118,6 +118,9 @@ abstract class AbstractFileDriver implements Driver
|
|||||||
{
|
{
|
||||||
$result = $this->_loadMappingFile($this->_findMappingFile($className));
|
$result = $this->_loadMappingFile($this->_findMappingFile($className));
|
||||||
|
|
||||||
|
if(!isset($result[$className])){
|
||||||
|
throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->_fileExtension);
|
||||||
|
}
|
||||||
return $result[$className];
|
return $result[$className];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,11 @@ class MappingException extends \Doctrine\ORM\ORMException
|
|||||||
return new self("No mapping file found named '$fileName' for class '$entityName'.");
|
return new self("No mapping file found named '$fileName' for class '$entityName'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function invalidMappingFile($entityName, $fileName)
|
||||||
|
{
|
||||||
|
return new self("Invalid mapping file '$fileName' for class '$entityName'.");
|
||||||
|
}
|
||||||
|
|
||||||
public static function mappingNotFound($className, $fieldName)
|
public static function mappingNotFound($className, $fieldName)
|
||||||
{
|
{
|
||||||
return new self("No mapping found for field '$fieldName' on class '$className'.");
|
return new self("No mapping found for field '$fieldName' on class '$className'.");
|
||||||
|
@ -51,6 +51,17 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
|
|||||||
$this->assertTrue($class->associationMappings['article']['id']);
|
$this->assertTrue($class->associationMappings['article']['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1468
|
||||||
|
*
|
||||||
|
* @expectedException Doctrine\ORM\Mapping\MappingException
|
||||||
|
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.xml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
|
||||||
|
*/
|
||||||
|
public function testInvalidMappingFileException()
|
||||||
|
{
|
||||||
|
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $xmlMappingFile
|
* @param string $xmlMappingFile
|
||||||
* @dataProvider dataValidSchema
|
* @dataProvider dataValidSchema
|
||||||
|
@ -43,4 +43,15 @@ class YamlMappingDriverTest extends AbstractMappingDriverTest
|
|||||||
$this->assertEquals('Doctrine\Tests\Models\DirectoryTree\Directory', $classDirectory->associationMappings['parentDirectory']['sourceEntity']);
|
$this->assertEquals('Doctrine\Tests\Models\DirectoryTree\Directory', $classDirectory->associationMappings['parentDirectory']['sourceEntity']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1468
|
||||||
|
*
|
||||||
|
* @expectedException Doctrine\ORM\Mapping\MappingException
|
||||||
|
* @expectedExceptionMessage Invalid mapping file 'Doctrine.Tests.Models.Generic.SerializationModel.dcm.yml' for class 'Doctrine\Tests\Models\Generic\SerializationModel'.
|
||||||
|
*/
|
||||||
|
public function testInvalidMappingFileException()
|
||||||
|
{
|
||||||
|
$this->createClassMetadata('Doctrine\Tests\Models\Generic\SerializationModel');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
|
||||||
|
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
|
||||||
|
|
||||||
|
<entity name="\stdClass">
|
||||||
|
<id name="id" type="integer" column="id">
|
||||||
|
<generator strategy="AUTO"/>
|
||||||
|
</id>
|
||||||
|
|
||||||
|
<field name="array" column="array" type="array"/>
|
||||||
|
|
||||||
|
<field name="object" column="object" type="object"/>
|
||||||
|
</entity>
|
||||||
|
|
||||||
|
</doctrine-mapping>
|
@ -0,0 +1,13 @@
|
|||||||
|
\stdClass:
|
||||||
|
type: entity
|
||||||
|
id:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
unsigned: true
|
||||||
|
generator:
|
||||||
|
strategy: AUTO
|
||||||
|
fields:
|
||||||
|
array:
|
||||||
|
type: array
|
||||||
|
object:
|
||||||
|
type: object
|
Loading…
Reference in New Issue
Block a user