Changeset 4352

Show
Ignore:
Timestamp:
05/10/08 03:04:35 (14 months ago)
Author:
jwage
Message:

fixes #1011

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Export.php

    r4319 r4352  
    10481048    } 
    10491049 
    1050     /** 
    1051      * exportClasses 
    1052      * method for exporting Doctrine_Record classes to a schema 
    1053      * 
    1054      * FIXME: This function has ugly hacks in it to make sure sql is inserted in the correct order. 
    1055      * 
    1056      * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS 
    1057      *                                          occurred during the create table operation 
    1058      * @param array $classes 
    1059      * @return void 
    1060      */ 
    1061      public function exportClasses(array $classes) 
    1062      { 
     1050    public function exportSortedClassesSql($classes, $groupByConnection = true) 
     1051    { 
    10631052         $connections = array(); 
    10641053         foreach ($classes as $class) { 
     
    11201109         } 
    11211110 
    1122          foreach ($build as $connectionName => $sql) { 
     1111         if ( ! $groupByConnection) { 
     1112             $new = array(); 
     1113             foreach($build as $connectionname => $sql) { 
     1114                 $new = array_merge($new, $sql); 
     1115             } 
     1116             $build = $new; 
     1117         } 
     1118         return $build; 
     1119    } 
     1120 
     1121    /** 
     1122     * exportClasses 
     1123     * method for exporting Doctrine_Record classes to a schema 
     1124     * 
     1125     * FIXME: This function has ugly hacks in it to make sure sql is inserted in the correct order. 
     1126     * 
     1127     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS 
     1128     *                                          occurred during the create table operation 
     1129     * @param array $classes 
     1130     * @return void 
     1131     */ 
     1132     public function exportClasses(array $classes) 
     1133     { 
     1134         $queries = $this->exportSortedClassesSql($classes); 
     1135 
     1136         foreach ($queries as $connectionName => $sql) { 
    11231137             $connection = Doctrine_Manager::getInstance()->getConnection($connectionName); 
    11241138 
     
    12691283        } 
    12701284         
    1271         return $this->exportClassesSql($models); 
     1285        return $this->exportSortedClassesSql($models, false); 
    12721286    } 
    12731287