diff --git a/doctrine-mapping.xsd b/doctrine-mapping.xsd
index f9c774d57..b66e027e9 100644
--- a/doctrine-mapping.xsd
+++ b/doctrine-mapping.xsd
@@ -17,6 +17,7 @@
+
@@ -166,6 +167,7 @@
+
@@ -212,6 +214,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -274,6 +286,12 @@
+
+
+
+
+
+
diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
index 3b8bf7e99..7fb780407 100644
--- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
@@ -248,7 +248,7 @@ class XmlDriver extends FileDriver
$mapping = array(
'fieldName' => (string) $embeddedMapping['name'],
'class' => (string) $embeddedMapping['class'],
- 'columnPrefix' => isset($embeddedMapping['class']) ? (string) $embeddedMapping['class'] : null,
+ 'columnPrefix' => isset($embeddedMapping['column-prefix']) ? (string) $embeddedMapping['column-prefix'] : null,
);
$metadata->mapEmbedded($mapping);
}
@@ -754,6 +754,11 @@ class XmlDriver extends FileDriver
$className = (string)$mappedSuperClass['name'];
$result[$className] = $mappedSuperClass;
}
+ } else if (isset($xmlElement->embeddable)) {
+ foreach ($xmlElement->embeddable as $embeddableElement) {
+ $embeddableName = (string) $embeddableElement['name'];
+ $result[$embeddableName] = $embeddableElement;
+ }
}
return $result;
diff --git a/tests/Doctrine/Tests/Models/ValueObjects/Name.php b/tests/Doctrine/Tests/Models/ValueObjects/Name.php
new file mode 100644
index 000000000..1c8360324
--- /dev/null
+++ b/tests/Doctrine/Tests/Models/ValueObjects/Name.php
@@ -0,0 +1,9 @@
+_loadDriver();
$em = $this->_getTestEntityManager();
- $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory();
+ $factory = new ClassMetadataFactory();
$em->getConfiguration()->setMetadataDriverImpl($driver);
$factory->setEntityManager($em);
@@ -52,6 +53,28 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest
$this->assertTrue($class->associationMappings['article']['id']);
}
+ public function testEmbeddableMapping()
+ {
+ $class = $this->createClassMetadata('Doctrine\Tests\Models\ValueObjects\Name');
+
+ $this->assertEquals(true, $class->isEmbeddedClass);
+ }
+
+ public function testEmbeddedMapping()
+ {
+ $class = $this->createClassMetadata('Doctrine\Tests\Models\ValueObjects\Person');
+
+ $this->assertEquals(
+ array(
+ 'name' => array(
+ 'class' => 'Doctrine\Tests\Models\ValueObjects\Name',
+ 'columnPrefix' => 'nm_'
+ )
+ ),
+ $class->embeddedClasses
+ );
+ }
+
/**
* @group DDC-1468
*
diff --git a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Name.dcm.xml b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Name.dcm.xml
new file mode 100644
index 000000000..97bb6a90e
--- /dev/null
+++ b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Name.dcm.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Person.dcm.xml b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Person.dcm.xml
new file mode 100644
index 000000000..c2480bca7
--- /dev/null
+++ b/tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.ValueObjects.Person.dcm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+