M
M
Mr Freeman2015-06-11 14:53:49
css
Mr Freeman, 2015-06-11 14:53:49

How to generate a 404 in the controller so that the rules are applied with $app->error(...)?

Hi all. I can’t solve one question, here are the config settings and error handling -

$app->error(function (\Exception $e, $code) use ($app) {
    if (!$app['config']['debug']) {
        switch ($code) {
            case 404:
                return $app['twig']->render('error/404.html.twig');
            default:
                return $app['twig']->render('error/500.html.twig');
        }
    }
});

Everything works fine here, when production - we generate templates, when dev - we get errors perfectly.
The problem is the following, I want to generate an error in the controller: In general, it returns 200, although it stops the script. And this one: Returns 404, though it doesn't use my settings, so it doesn't care if it's production or not. How to be bright minds? :)
$this->app->abort(404, 'msg');
return new Response('Error', 404);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Grimashevich, 2018-08-26
@jams

Look towards OWL, with its help you can implement such a slider.

A
Amir Alimzhanov, 2018-08-26
@Amirez

Slick-slider, LightSlider, owlCarousel, Flex Slider

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question