diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
index b676ca8da..fd6bf081a 100644
--- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
@@ -89,7 +89,7 @@ class XmlDriver extends AbstractFileDriver
if (isset($xmlRoot['schema'])) {
$metadata->table['schema'] = (string)$xmlRoot['schema'];
}*/
-
+
if (isset($xmlRoot['inheritance-type'])) {
$inheritanceType = (string)$xmlRoot['inheritance-type'];
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
@@ -327,6 +327,8 @@ class XmlDriver extends AbstractFileDriver
if (isset($oneToManyElement['index-by'])) {
$mapping['indexBy'] = (string)$oneToManyElement['index-by'];
+ } else if (isset($oneToManyElement->{'index-by'})) {
+ throw new \InvalidArgumentException(" is not a valid tag");
}
$metadata->mapOneToMany($mapping);
@@ -432,8 +434,10 @@ class XmlDriver extends AbstractFileDriver
$mapping['orderBy'] = $orderBy;
}
- if (isset($manyToManyElement->{'index-by'})) {
- $mapping['indexBy'] = (string)$manyToManyElement->{'index-by'};
+ if (isset($manyToManyElement['index-by'])) {
+ $mapping['indexBy'] = (string)$manyToManyElement['index-by'];
+ } else if (isset($manyToManyElement->{'index-by'})) {
+ throw new \InvalidArgumentException(" is not a valid tag");
}
$metadata->mapManyToMany($mapping);