From 3048620a05f591b9160827aeb559102bf0d2555c Mon Sep 17 00:00:00 2001
From: "Jonathan.Wage" <Jonathan.Wage@625475ce-881a-0410-a577-b389adb331d8>
Date: Mon, 15 Oct 2007 15:01:54 +0000
Subject: [PATCH] Fixes for buildingsql and generating models.

---
 lib/Doctrine/Cli/Task/GenerateSql.php | 7 ++++++-
 lib/Doctrine/Import/Builder.php       | 8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/Doctrine/Cli/Task/GenerateSql.php b/lib/Doctrine/Cli/Task/GenerateSql.php
index 30a97ca5b..4cb77ef08 100644
--- a/lib/Doctrine/Cli/Task/GenerateSql.php
+++ b/lib/Doctrine/Cli/Task/GenerateSql.php
@@ -49,6 +49,11 @@ class Doctrine_Cli_Task_GenerateSql extends Doctrine_Cli_Task
             throw new Doctrine_Cli_Exception('Invalid sql path.');
         }
         
-        file_put_contents($path, implode("\n", $sql));
+        $build = '';
+        foreach ($sql as $query) {
+            $build .= $query.";\n";
+        }
+        
+        file_put_contents($path, $build);
     }
 }
\ No newline at end of file
diff --git a/lib/Doctrine/Import/Builder.php b/lib/Doctrine/Import/Builder.php
index ca65c79cf..968c27cb2 100644
--- a/lib/Doctrine/Import/Builder.php
+++ b/lib/Doctrine/Import/Builder.php
@@ -397,12 +397,12 @@ END;
         $className = $options['className'];
         $extends = isset($options['inheritance']['extends']) ? $options['inheritance']['extends']:'Doctrine_Record';
 
-        if (isset($options['no_definition']) && $options['no_definition'] === false) {
-            $definition = null;
-            $setUp = null;
-        } else {
+        if (!(isset($options['no_definition']) && $options['no_definition'] === true)) {
             $definition = $this->buildTableDefinition($options, $columns, $relations, $indexes);
             $setUp = $this->buildSetUp($options, $columns, $relations);
+        } else {
+            $definition = null;
+            $setUp = null;
         }
         
         $accessors = (isset($options['generate_accessors']) && $options['generate_accessors'] === true) ? $this->buildAccessors($options, $columns):null;