diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php index ae297c84f..2af1eb04b 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ConvertDoctrine1SchemaCommand.php @@ -134,16 +134,16 @@ EOT } $converter = new ConvertDoctrine1Schema($fromPaths); - $metadatas = $converter->getMetadatas(); + $metadata = $converter->getMetadata(); if ($metadatas) { $output->write(PHP_EOL); - foreach ($metadatas as $metadata) { - $output->write(sprintf('Processing entity "%s"', $metadata->name) . PHP_EOL); + foreach ($metadata as $class) { + $output->write(sprintf('Processing entity "%s"', $class->name) . PHP_EOL); } - $exporter->setMetadatas($metadatas); + $exporter->setMetadata($metadata); $exporter->export(); $output->write(PHP_EOL . sprintf( diff --git a/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php index c350ca045..6770e6360 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php @@ -97,8 +97,8 @@ EOT } $cmf = new DisconnectedClassMetadataFactory($em); - $metadatas = $cmf->getAllMetadata(); - $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); + $metadata = $cmf->getAllMetadata(); + $metadata = MetadataFilter::filter($metadata, $input->getOption('filter')); // Process destination directory if ( ! is_dir($destPath = $input->getArgument('dest-path'))) { @@ -132,12 +132,12 @@ EOT } } - if (count($metadatas)) { - foreach ($metadatas as $metadata) { - $output->write(sprintf('Processing entity "%s"', $metadata->name) . PHP_EOL); + if (count($metadata)) { + foreach ($metadata as $class) { + $output->write(sprintf('Processing entity "%s"', $class->name) . PHP_EOL); } - $exporter->setMetadatas($metadatas); + $exporter->setMetadata($metadata); $exporter->export(); $output->write(PHP_EOL . sprintf( diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index a1fd97bb1..d0eb5e9f0 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -41,7 +41,8 @@ class ConvertDoctrine1Schema private $_legacyTypeMap = array( // TODO: This list may need to be updated 'clob' => 'text', - 'timestamp' => 'datetime' + 'timestamp' => 'datetime', + 'enum' => 'string' ); /** @@ -238,6 +239,7 @@ class ConvertDoctrine1Schema if (isset($relation['refClass'])) { $type = 'many'; $foreignType = 'many'; + $joinColumns = array(); } else { $type = isset($relation['type']) ? $relation['type'] : 'one'; $foreignType = isset($relation['foreignType']) ? $relation['foreignType'] : 'many'; diff --git a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php index 82c18035e..74740dbe4 100644 --- a/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php @@ -76,6 +76,8 @@ class extends EntityRepository mkdir($dir, 0777, true); } - file_put_contents($path, $code); + if ( ! file_exists($path)) { + file_put_contents($path, $code); + } } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Tools/ToolsException.php b/lib/Doctrine/ORM/Tools/ToolsException.php index db13d862a..f7ed87105 100644 --- a/lib/Doctrine/ORM/Tools/ToolsException.php +++ b/lib/Doctrine/ORM/Tools/ToolsException.php @@ -2,8 +2,12 @@ namespace Doctrine\ORM\Tools; -class ToolsException extends ORMException { - public static function couldNotMapDoctrine1Type($type) { +use Doctrine\ORM\ORMException; + +class ToolsException extends ORMException +{ + public static function couldNotMapDoctrine1Type($type) + { return new self("Could not map doctrine 1 type '$type'!"); } } \ No newline at end of file