We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

undefined method Phalcon\Flash\Direct::output()

When I add a css class for flashSession, it shows an error.

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

Call to undefined method Phalcon\Flash\Direct::output()



40.8k
Accepted
answer
edited Mar '14

You did mistake, should be

$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',
        ));
    }
);

or

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