Changeset 3820

Show
Ignore:
Timestamp:
02/17/08 04:57:25 (17 months ago)
Author:
gnat
Message:

pre/post Up/Down methods

Files:
1 modified

Legend:

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

    r3228 r3820  
    331331    protected function doMigrate($direction) 
    332332    { 
    333         if (! method_exists($this, $direction)) { 
    334             return; 
    335         } 
    336         $this->$direction(); 
    337  
    338         foreach ($this->_changes as $type => $changes) { 
    339             $process = new Doctrine_Migration_Process(); 
    340             $funcName = 'process' . Doctrine::classify($type); 
    341  
    342             if ( ! empty($changes)) { 
    343                 $process->$funcName($changes);  
     333        $method = 'pre'.$direction; 
     334        $this->$method(); 
     335 
     336        if (method_exists($this, $direction)) { 
     337            $this->$direction(); 
     338 
     339            foreach ($this->_changes as $type => $changes) { 
     340                $process = new Doctrine_Migration_Process(); 
     341                $funcName = 'process' . Doctrine::classify($type); 
     342 
     343                if ( ! empty($changes)) { 
     344                    $process->$funcName($changes);  
     345                } 
    344346            } 
    345347        } 
     348 
     349        $method = 'post'.$direction; 
     350        $this->$method(); 
    346351    } 
    347352 
     
    585590        $this->addChange('removed_indexes', $options); 
    586591    } 
     592 
     593    /** 
     594     * preUp 
     595     * 
     596     * @return void 
     597     */ 
     598    public function preUp() 
     599    { 
     600        return; 
     601    } 
     602 
     603    /** 
     604     * postUp 
     605     * 
     606     * @return void 
     607     */ 
     608    public function postUp() 
     609    { 
     610        return; 
     611    } 
     612 
     613    /** 
     614     * preDown 
     615     * 
     616     * @return void 
     617     */ 
     618    public function preDown() 
     619    { 
     620        return; 
     621    } 
     622 
     623    /** 
     624     * postDown 
     625     * 
     626     * @return void 
     627     */ 
     628    public function postDown() 
     629    { 
     630        return; 
     631    } 
     632     
    587633}