Conditions | 6 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function onDispatch(MvcEvent $e) |
||
27 | { |
||
28 | if (!$e->getRequest() instanceof ConsoleRequest) { |
||
29 | throw new RuntimeException('You can only use this action from a console!'); |
||
30 | } |
||
31 | |||
32 | $version = $e->getRequest()->getParam('version'); |
||
33 | $force = $e->getRequest()->getParam('force'); |
||
34 | $down = $e->getRequest()->getParam('down'); |
||
35 | $fake = $e->getRequest()->getParam('fake'); |
||
36 | |||
37 | if (is_null($version) && $force) { |
||
38 | $response = "Can't force migration apply without migration version explicitly set.\n"; |
||
39 | $e->setResult($response); |
||
40 | return $response; |
||
41 | } |
||
42 | |||
43 | if (is_null($version) && $fake) { |
||
44 | $response = "Can't fake migration apply without migration version explicitly set.\n"; |
||
45 | $e->setResult($response); |
||
46 | return $response; |
||
47 | } |
||
48 | |||
49 | $this->migration->migrate($version, $force, $down, $fake); |
||
50 | $response = "Migrations applied!\n"; |
||
51 | |||
52 | $e->setResult($response); |
||
53 | return $response; |
||
54 | } |
||
55 | } |
||
56 |