way to trigger error

I just do a litle search, and can not found an easy way. has phalcon a feature for triggering error? like show_error() on CI or App::abort() on Laravel ?

edited Jun '14

Hi @Sum
Yes you can use flash to display errors. http://docs.phalconphp.com/en/latest/reference/flash.html In my project I use it like this.

        $di->set(     
                'flashSession', function ()    
        {    
            return new Phalcon\Flash\Session(array(    
                'error' => 'alert alert-dismissable alert-danger',    
                'success' => 'alert alert-dismissable alert-success',    
                'notice' => 'alert alert-dismissable alert-info',    
            ));    
        }    
        );

Then you can call

    $this->flash->success("The post was correctly saved!");

This

    'error' => 'alert alert-dismissable alert-danger',

is a reference to the css class representing the error. This line of code is an example from bootstrap error.



10.2k
edited Jun '14

Flash error not actually what I'm looking for, Maybe something like dispatcher->forward() is closer but I think that's not an error trigger.

Thanks anyway.