diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index c917eb245..7f9a7ecc9 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -384,12 +384,12 @@ class XmlDriver extends FileDriver $mapping['orphanRemoval'] = $this->evaluateBoolean($oneToOneElement['orphan-removal']); } - $metadata->mapOneToOne($mapping); - // Evaluate second level cache if (isset($oneToOneElement->cache)) { - $metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToOneElement->cache)); + $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($oneToOneElement->cache)); } + + $metadata->mapOneToOne($mapping); } } @@ -428,12 +428,12 @@ class XmlDriver extends FileDriver throw new \InvalidArgumentException(" is not a valid tag"); } - $metadata->mapOneToMany($mapping); - // Evaluate second level cache if (isset($oneToManyElement->cache)) { - $metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($oneToManyElement->cache)); + $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($oneToManyElement->cache)); } + + $metadata->mapOneToMany($mapping); } } @@ -473,12 +473,13 @@ class XmlDriver extends FileDriver $mapping['cascade'] = $this->_getCascadeMappings($manyToOneElement->cascade); } - $metadata->mapManyToOne($mapping); - // Evaluate second level cache if (isset($manyToOneElement->cache)) { - $metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToOneElement->cache)); + $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($manyToOneElement->cache)); } + + $metadata->mapManyToOne($mapping); + } } @@ -543,12 +544,12 @@ class XmlDriver extends FileDriver throw new \InvalidArgumentException(" is not a valid tag"); } - $metadata->mapManyToMany($mapping); - // Evaluate second level cache if (isset($manyToManyElement->cache)) { - $metadata->enableAssociationCache($mapping['fieldName'], $this->cacheToArray($manyToManyElement->cache)); + $mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], $this->cacheToArray($manyToManyElement->cache)); } + + $metadata->mapManyToMany($mapping); } }