| @@ 34-49 (lines=16) @@ | ||
| 31 | * @return mixed |
|
| 32 | * @throws \Exception |
|
| 33 | */ |
|
| 34 | public function execute(MigrationStep $step) |
|
| 35 | { |
|
| 36 | parent::execute($step); |
|
| 37 | ||
| 38 | if (!isset($step->dsl['mode'])) { |
|
| 39 | throw new \Exception("Invalid step definition: missing 'mode'"); |
|
| 40 | } |
|
| 41 | ||
| 42 | $action = $step->dsl['mode']; |
|
| 43 | ||
| 44 | if (!in_array($action, $this->supportedActions)) { |
|
| 45 | throw new \Exception("Invalid step definition: value '$action' is not allowed for 'mode'"); |
|
| 46 | } |
|
| 47 | ||
| 48 | return $this->$action($step->dsl, $step->context); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @todo allow to save to disk |
|
| @@ 32-47 (lines=16) @@ | ||
| 29 | * @return mixed |
|
| 30 | * @throws \Exception |
|
| 31 | */ |
|
| 32 | public function execute(MigrationStep $step) |
|
| 33 | { |
|
| 34 | parent::execute($step); |
|
| 35 | ||
| 36 | if (!isset($step->dsl['mode'])) { |
|
| 37 | throw new \Exception("Invalid step definition: missing 'mode'"); |
|
| 38 | } |
|
| 39 | ||
| 40 | $action = $step->dsl['mode']; |
|
| 41 | ||
| 42 | if (!in_array($action, $this->supportedActions)) { |
|
| 43 | throw new \Exception("Invalid step definition: value '$action' is not allowed for 'mode'"); |
|
| 44 | } |
|
| 45 | ||
| 46 | return $this->$action($step->dsl, $step->context); |
|
| 47 | } |
|
| 48 | ||
| 49 | protected function set($dsl, $context) { |
|
| 50 | if (!isset($dsl['identifier'])) { |
|