Last active
August 29, 2015 14:00
-
-
Save shadowhand/226cc11d3d7ede99dd66 to your computer and use it in GitHub Desktop.
register controller using use case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* snip */ | |
$parser = $app->get('user.parse.register'); | |
$usecase = $app->get('usecase.user.register'); | |
$params = $this->request->post(); | |
try | |
{ | |
$user = $parser($params); | |
$userid = $usecase->interact($user); | |
// TODO: this should forward to the login use case | |
$this->redirect('user/login' . URL::query()); | |
} | |
catch (Ushahidi\Exception\Validator $e) | |
{ | |
$this->template = View::factory('user/register') | |
->set('error', implode(', ', Arr::flatten($e->getErrors()))) | |
->set('form', $params); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment