Beispiel #1
0
 /**
  * @param $fromIndex
  * @param $toIndex
  * @param Step[] $steps
  * @throws \Exception
  */
 private function stepDown($fromIndex, $toIndex, $steps)
 {
     for ($i = $fromIndex; $i > $toIndex; $i--) {
         if (!$steps[$i]->canBeUndone()) {
             throw new \Exception('Cannot migrate down. Step [' . get_class($steps[$i]) . '] cannot be undone.');
         }
     }
     for ($i = $fromIndex; $i > $toIndex; $i--) {
         $this->dispatcher->fire(new MigrateDownEvent($steps[$i]));
         $steps[$i]->down();
     }
 }
Beispiel #2
0
 protected function fire(CollectionEvent $event)
 {
     if ($this->dispatcher) {
         $this->dispatcher->fire($event);
     }
 }
Beispiel #3
0
 private function whenIFire($event)
 {
     $this->dispatcher->fire(new $event());
 }