Changeset 2963 for trunk/lib/Doctrine.php
- Timestamp:
- 10/21/07 07:23:59 (15 months ago)
- Files:
-
- 1 modified
-
trunk/lib/Doctrine.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Doctrine.php
r2951 r2963 350 350 */ 351 351 const HYDRATE_RECORD = 2; 352 352 353 353 /** 354 354 * HYDRATE_ARRAY … … 737 737 public static function createDatabases($specifiedConnections = array()) 738 738 { 739 if ( !is_array($specifiedConnections)) {739 if ( ! is_array($specifiedConnections)) { 740 740 $specifiedConnections = (array) $specifiedConnections; 741 741 } … … 745 745 746 746 foreach ($connections as $name => $connection) { 747 if ( !empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {747 if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) { 748 748 continue; 749 749 } … … 784 784 public static function dropDatabases($specifiedConnections = array()) 785 785 { 786 if ( !is_array($specifiedConnections)) {786 if ( ! is_array($specifiedConnections)) { 787 787 $specifiedConnections = (array) $specifiedConnections; 788 788 } … … 793 793 794 794 foreach ($connections as $name => $connection) { 795 if ( !empty($specifiedConnections) && !in_array($name, $specifiedConnections)) {795 if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) { 796 796 continue; 797 797 } … … 835 835 $data = new Doctrine_Data(); 836 836 837 if ( !$append) {837 if ( ! $append) { 838 838 $data->purge(); 839 839 } … … 855 855 $data = new Doctrine_Data(); 856 856 857 if ( !$append) {857 if ( ! $append) { 858 858 $data->purge(); 859 859 } … … 861 861 return $data->importDummyData($num); 862 862 } 863 863 864 864 /** 865 865 * migrate … … 921 921 return $builder->generateMigrationsFromModels($modelsPath); 922 922 } 923 923 924 924 /** 925 925 * getTable … … 932 932 return Doctrine_Manager::table($tableName); 933 933 } 934 934 935 935 /** 936 936 * connection … … 944 944 return Doctrine_Manager::connection($adapter, $name); 945 945 } 946 946 947 947 /** 948 948 * fileFinder … … 955 955 return Doctrine_FileFinder::type($type); 956 956 } 957 957 958 958 /** 959 959 * compile … … 971 971 return Doctrine_Compiler::compile($target, $includedDrivers); 972 972 } 973 973 974 974 /** 975 975 * simple autoload function … … 999 999 return true; 1000 1000 } 1001 1001 1002 1002 /** 1003 1003 * dump … … 1031 1031 return implode("\n", $ret); 1032 1032 } 1033 1033 1034 1034 /** 1035 1035 * returns table name from class name … … 1042 1042 return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $classname)); 1043 1043 } 1044 1044 1045 1045 /** 1046 1046 * returns class name from table name … … 1053 1053 return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine", "classifyCallback"), ucfirst($tablename)); 1054 1054 } 1055 1055 1056 1056 /** 1057 1057 * Callback function to classify a classname propperly. … … 1064 1064 return $matches[1] . strtoupper($matches[3]); 1065 1065 } 1066 1066 1067 1067 /** 1068 1068 * checks for valid class name (uses camel case and underscores)