From 04b23dbf100ceb5401f3bc83e689535905ef9dd3 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 27 May 2012 18:44:31 +0200 Subject: [PATCH] [DDC-1798] Exporter generate error when composite primary key is generated. Fixes GH-342 --- lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php | 2 +- lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php | 2 +- lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php index d66171266..21b7035d9 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php @@ -92,7 +92,7 @@ class PhpExporter extends AbstractExporter $lines[] = '$metadata->mapField(' . $this->_varExport($fieldMapping) . ');'; } - if ($generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { + if ( ! $metadata->isIdentifierComposite && $generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { $lines[] = '$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_' . $generatorType . ');'; } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index 176c5e1e6..2ecd37a7b 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -130,7 +130,7 @@ class XmlExporter extends AbstractExporter } } - if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { + if ( ! $metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { $id[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType; } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index ed5c102aa..c9680c10a 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -114,7 +114,7 @@ class YamlExporter extends AbstractExporter $fieldMappings[$name] = $fieldMapping; } - if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { + if ( ! $metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { $ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType; }