kkreft
4/6/2016 - 10:50 AM

S2 Process with callback

S2 Process with callback

$session = $this->get('session');

$process = new Process($cmd);
$process->run(function($type, $buffer) use($session) {

    if ('err' === $type) {
        $session->getFlashBag()->add(
            'error',
            $buffer
        );
    } else {
        $session->getFlashBag()->add(
            'success',
            $buffer
        );
    }

});