Changeset 4940
- Timestamp:
- 08/30/07 16:11:28 (2 years ago)
- Files:
-
- trunk/lib/addon/propel/sfPropelData.class.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/addon/propel/sfPropelData.class.php
r4910 r4940 21 21 { 22 22 protected 23 $maps = array(); 23 $maps = array(), 24 $deletedClasses = array(), 25 $con = null; 24 26 25 27 // symfony load-data (file|dir) … … 37 39 38 40 // wrap all database operations in a single transaction 39 $ con = Propel::getConnection($connectionName);41 $this->con = Propel::getConnection($connectionName); 40 42 try 41 43 { 42 $ con->begin();44 $this->con->begin(); 43 45 44 46 $this->doDeleteCurrentData($fixture_files); … … 46 48 $this->doLoadData($fixture_files); 47 49 48 $ con->commit();50 $this->con->commit(); 49 51 } 50 52 catch (Exception $e) 51 53 { 52 $ con->rollback();54 $this->con->rollback(); 53 55 throw $e; 54 56 } … … 137 139 } 138 140 } 139 $obj->save( );141 $obj->save($this->con); 140 142 141 143 // save the id for future reference … … 180 182 foreach ($classes as $class) 181 183 { 182 $peer_class = trim($class.'Peer'); 184 $class = trim($class); 185 if (in_array($class, $this->deletedClasses)) 186 { 187 continue; 188 } 189 190 $peer_class = $class.'Peer'; 183 191 184 192 if (!$classPath = sfAutoload::getClassPath($peer_class)) … … 189 197 require_once($classPath); 190 198 191 call_user_func(array($peer_class, 'doDeleteAll')); 199 call_user_func(array($peer_class, 'doDeleteAll'), $this->con); 200 201 $this->deletedClasses[] = $class; 192 202 } 193 203 } … … 238 248 } 239 249 240 $ con = Propel::getConnection($connectionName);250 $this->con = Propel::getConnection($connectionName); 241 251 242 252 // get tables … … 276 286 277 287 // get db info 278 $rs = $ con->executeQuery('SELECT * FROM '.constant($tableName.'Peer::TABLE_NAME'));288 $rs = $this->con->executeQuery('SELECT * FROM '.constant($tableName.'Peer::TABLE_NAME')); 279 289 280 290 while ($rs->next())

