Changeset 3672
- Timestamp:
- 01/29/08 23:14:24 (17 months ago)
- Location:
- branches
- Files:
-
- 6 modified
-
0.10/lib/Doctrine.php (modified) (5 diffs)
-
0.10/lib/Doctrine/Lib.php (modified) (1 diff)
-
0.10/lib/Doctrine/Task/Dql.php (modified) (1 diff)
-
0.9/lib/Doctrine.php (modified) (3 diffs)
-
0.9/lib/Doctrine/Lib.php (modified) (1 diff)
-
0.9/lib/Doctrine/Task/Dql.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine.php
r3623 r3672 469 469 private static $_loadedModelFiles = array(); 470 470 471 private static $_pathModels = array(); 472 471 473 /** 472 474 * _validators … … 488 490 } 489 491 492 public static function getLoadedModelFiles() 493 { 494 return self::$_loadedModelFiles; 495 } 496 497 public static function getPathModels() 498 { 499 return self::$_pathModels; 500 } 501 490 502 /** 491 503 * debug … … 529 541 { 530 542 $loadedModels = array(); 531 543 532 544 if ($directory !== null) { 533 545 $manager = Doctrine_Manager::getInstance(); 534 546 535 547 foreach ((array) $directory as $dir) { 536 548 $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), … … 539 551 $e = explode('.', $file->getFileName()); 540 552 if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { 541 553 542 554 if ($manager->getAttribute(Doctrine::ATTR_MODEL_LOADING) == Doctrine::MODEL_LOADING_CONSERVATIVE) { 543 555 self::$_loadedModelFiles[$e[0]] = $file->getPathName(); 556 self::$_pathModels[$file->getPathName()][$e[0]] = $e[0]; 557 544 558 $loadedModels[] = $e[0]; 545 559 } else { 546 560 $declaredBefore = get_declared_classes(); 547 561 require_once($file->getPathName()); 548 562 549 563 $declaredAfter = get_declared_classes(); 550 564 // Using array_slice because array_diff is broken is some PHP versions … … 554 568 if (self::isValidModelClass($className) && !in_array($className, $loadedModels)) { 555 569 $loadedModels[] = $className; 570 571 self::$_pathModels[$file->getPathName()][$className] = $className; 556 572 } 557 573 } -
branches/0.10/lib/Doctrine/Lib.php
r3258 r3672 397 397 } 398 398 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 399 431 /** 400 432 * isValidClassName -
branches/0.10/lib/Doctrine/Task/Dql.php
r2950 r3672 50 50 $results = $query->query($dql); 51 51 52 $this-> printResults($results);52 $this->_printResults($results); 53 53 } 54 54 55 protected function printResults($data)55 protected function _printResults($data) 56 56 { 57 57 $array = $data->toArray(true); -
branches/0.9/lib/Doctrine.php
r3623 r3672 445 445 */ 446 446 private static $_loadedModels = array(); 447 447 448 private static $_pathModels = array(); 449 448 450 /** 449 451 * _validators … … 463 465 { 464 466 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; 465 480 } 466 481 … … 516 531 if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { 517 532 self::$_loadedModels[$e[0]] = $file->getPathName(); 533 self::$_pathModels[$file->getPathName()][$e[0]] = $e[0]; 518 534 } 519 535 } -
branches/0.9/lib/Doctrine/Lib.php
r3469 r3672 327 327 return implode("\n",$r); 328 328 } 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 } 329 364 } -
branches/0.9/lib/Doctrine/Task/Dql.php
r2950 r3672 50 50 $results = $query->query($dql); 51 51 52 $this-> printResults($results);52 $this->_printResults($results); 53 53 } 54 54 55 protected function printResults($data)55 protected function _printResults($data) 56 56 { 57 57 $array = $data->toArray(true);