Example #1
0
use Lw\Application\Service\User\SignInUserRequest;
use Lw\Application\Service\User\ViewBadgesRequest;
use Lw\Application\Service\User\ViewBadgesService;
use Lw\Application\Service\User\ViewWishesRequest;
use Lw\Application\Service\Wish\UpdateWishRequest;
use Lw\Domain\Model\User\UserAlreadyExistsException;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Request;
$filename = __DIR__ . preg_replace('#(\\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
    return false;
}
error_reporting(E_ALL);
require_once __DIR__ . '/../../../../../../../vendor/autoload.php';
$app = \Lw\Infrastructure\Ui\Web\Silex\Application::bootstrap();
// Home
$app->get('/', function () use($app) {
    return $app['twig']->render('layout.html.twig');
})->bind('home');
$app->match('/signin', function (Request $request) use($app) {
    /**
     * @var Form $form
     */
    $form = $app['sign_in_form'];
    $form->handleRequest($request);
    if ($form->isValid()) {
        $data = $form->getData();
        try {
            $app['sign_in_user_application_service']->execute(new SignInUserRequest($data['email'], $data['password']));
            return $app->redirect($app['url_generator']->generate('login'));