Changeset 3672

Show
Ignore:
Timestamp:
01/29/08 23:14:24 (17 months ago)
Author:
guilhermeblanco
Message:

Added changeset #3624 into 0.9 and 0.10 branches

Location:
branches
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine.php

    r3623 r3672  
    469469    private static $_loadedModelFiles = array(); 
    470470 
     471    private static $_pathModels = array(); 
     472 
    471473    /** 
    472474     * _validators 
     
    488490    } 
    489491 
     492    public static function getLoadedModelFiles() 
     493    { 
     494        return self::$_loadedModelFiles; 
     495    } 
     496     
     497    public static function getPathModels() 
     498    { 
     499        return self::$_pathModels; 
     500    } 
     501 
    490502    /** 
    491503     * debug 
     
    529541    { 
    530542        $loadedModels = array(); 
    531          
     543 
    532544        if ($directory !== null) { 
    533545            $manager = Doctrine_Manager::getInstance(); 
    534              
     546 
    535547            foreach ((array) $directory as $dir) { 
    536548                $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), 
     
    539551                    $e = explode('.', $file->getFileName()); 
    540552                    if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { 
    541                          
     553 
    542554                        if ($manager->getAttribute(Doctrine::ATTR_MODEL_LOADING) == Doctrine::MODEL_LOADING_CONSERVATIVE) { 
    543555                            self::$_loadedModelFiles[$e[0]] = $file->getPathName(); 
     556                            self::$_pathModels[$file->getPathName()][$e[0]] = $e[0]; 
     557 
    544558                            $loadedModels[] = $e[0]; 
    545559                        } else { 
    546560                            $declaredBefore = get_declared_classes(); 
    547561                            require_once($file->getPathName()); 
    548                              
     562 
    549563                            $declaredAfter = get_declared_classes(); 
    550564                            // Using array_slice because array_diff is broken is some PHP versions 
     
    554568                                    if (self::isValidModelClass($className) && !in_array($className, $loadedModels)) { 
    555569                                        $loadedModels[] = $className; 
     570 
     571                                        self::$_pathModels[$file->getPathName()][$className] = $className; 
    556572                                    } 
    557573                                } 
  • branches/0.10/lib/Doctrine/Lib.php

    r3258 r3672  
    397397    } 
    398398 
     399    public static function copyDirectory($source, $dest) 
     400    { 
     401        // Simple copy for a file 
     402        if (is_file($source)) { 
     403            return copy($source, $dest); 
     404        } 
     405 
     406        // Make destination directory 
     407        if ( ! is_dir($dest)) { 
     408            mkdir($dest); 
     409        } 
     410 
     411        // Loop through the folder 
     412        $dir = dir($source); 
     413        while (false !== $entry = $dir->read()) { 
     414            // Skip pointers 
     415            if ($entry == '.' || $entry == '..') { 
     416                continue; 
     417            } 
     418 
     419            // Deep copy directories 
     420            if ($dest !== "$source/$entry") { 
     421                self::copyDirectory("$source/$entry", "$dest/$entry"); 
     422            } 
     423        } 
     424 
     425        // Clean up 
     426        $dir->close(); 
     427 
     428        return true; 
     429    } 
     430 
    399431    /** 
    400432     * isValidClassName 
  • branches/0.10/lib/Doctrine/Task/Dql.php

    r2950 r3672  
    5050        $results = $query->query($dql); 
    5151         
    52         $this->printResults($results); 
     52        $this->_printResults($results); 
    5353    } 
    5454     
    55     protected function printResults($data) 
     55    protected function _printResults($data) 
    5656    { 
    5757        $array = $data->toArray(true); 
  • branches/0.9/lib/Doctrine.php

    r3623 r3672  
    445445     */ 
    446446    private static $_loadedModels = array(); 
    447      
     447 
     448    private static $_pathModels = array(); 
     449 
    448450    /** 
    449451     * _validators 
     
    463465    { 
    464466        throw new Doctrine_Exception('Doctrine is static class. No instances can be created.'); 
     467    } 
     468 
     469    public static function getLoadedModelFiles() 
     470    { 
     471        // [TODO] This method is just a wrapper of _loadedModels 
     472        // (which has named changed to _loadedModelFiles). The next task is 
     473        // to rename the _loadedModels to _loadedModelFiles inside Doctrine 
     474        return self::$_loadedModels; 
     475    } 
     476 
     477    public static function getPathModels() 
     478    { 
     479        return self::$_pathModels; 
    465480    } 
    466481 
     
    516531                    if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { 
    517532                        self::$_loadedModels[$e[0]] = $file->getPathName(); 
     533                        self::$_pathModels[$file->getPathName()][$e[0]] = $e[0]; 
    518534                    } 
    519535                } 
  • branches/0.9/lib/Doctrine/Lib.php

    r3469 r3672  
    327327        return implode("\n",$r); 
    328328    } 
     329 
     330 
     331    // [TODO] Figure it out why this is necessary (was added in trunk and 0.10 branch) 
     332    // Please refer to Changeset #3624 where this piece of code was applied 
     333    public static function copyDirectory($source, $dest) 
     334    { 
     335        // Simple copy for a file 
     336        if (is_file($source)) { 
     337            return copy($source, $dest); 
     338        } 
     339 
     340        // Make destination directory 
     341        if ( ! is_dir($dest)) { 
     342            mkdir($dest); 
     343        } 
     344 
     345        // Loop through the folder 
     346        $dir = dir($source); 
     347        while (false !== $entry = $dir->read()) { 
     348            // Skip pointers 
     349            if ($entry == '.' || $entry == '..') { 
     350                continue; 
     351            } 
     352 
     353            // Deep copy directories 
     354            if ($dest !== "$source/$entry") { 
     355                self::copyDirectory("$source/$entry", "$dest/$entry"); 
     356            } 
     357        } 
     358 
     359        // Clean up 
     360        $dir->close(); 
     361 
     362        return true; 
     363    } 
    329364} 
  • branches/0.9/lib/Doctrine/Task/Dql.php

    r2950 r3672  
    5050        $results = $query->query($dql); 
    5151         
    52         $this->printResults($results); 
     52        $this->_printResults($results); 
    5353    } 
    5454     
    55     protected function printResults($data) 
     55    protected function _printResults($data) 
    5656    { 
    5757        $array = $data->toArray(true);