InvalidArgumentException: Identifier "security.last_error" is not defined.
$app->register(new Silex\Provider\SecurityServiceProvider());
$app['security.firewalls'] = array(
'admin' => array(
'pattern' => '^/admin',
'http' => true,
'users' => array(
'admin' => array(admin),
),
),
);
Вот урезанный код. Может что-то увидите?
$app->match('/add/{flat_id}', function (Request $request, $flat_id) use ($app) {
$form = $app['form.factory']->createBuilder('form', $data)
->add('attachment', 'file')
->add('type', 'choice', array(
'choices' => array(
'1' => 'Студия',
'2' => 'Однушка',
'3' => 'Евродвушка',
'4' => 'Двушка',
'5' => 'Трешка',
'6' => 'Четвирешка :)'),
'expanded' => false
))
->add('square_total')
...
->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$data = $form->getData();
$app['db']->insert('vn_db_flats', array(
'attachment' => rand(1,999) . $data['attachment']->getClientOriginalName(),
'type' => $data['type'],
'square_total' => $data['square_total'],
...
));
$data['attachment']->move(__DIR__ . '/attach/', $data['attachment']->getClientOriginalName());
return $app->redirect($app['url_generator']->generate('index'));
}
}
return $app['twig']->render('add.twig', array('form' => $form->createView()));
})
->bind('add')
->value('flat_id', '0');