Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
56 | public function onDispatch(MvcEvent $e) |
||
57 | { |
||
58 | $entity = $this->creator->create($this->data); |
||
59 | |||
60 | if ($entity) { |
||
61 | if ($this->redirectTo) { |
||
62 | return $this->redirect()->toRoute($this->redirectTo); |
||
63 | } |
||
64 | |||
65 | $this->viewModel->setEntity($entity); |
||
66 | } else { |
||
67 | $this->viewModel->setErrors($this->creator->getErrors()); |
||
68 | $this->viewModel->setInputData($this->data); |
||
69 | } |
||
70 | |||
71 | $e->setResult($this->viewModel); |
||
72 | |||
73 | return $this->viewModel; |
||
74 | } |
||
75 | } |
||
76 |