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

Call Stored Procedure in Phalcon with mssql

Hi, I'm using this https://github.com/fishjerky/phalcon-mssql library but when I try to call a stored procedure doesn't work.

Example:

$user =  new Usuariosgrupossistema();
$result = $user->getReadConnection()->query(`CALL spGetOffice`)->fetchAll();
var_dump($result);

//$result in view -> array(0) { } 

CALL spGetOffice is wrapped with backsticks

Thanks in advance

private static function composeResultSet($sql) {
        $routine = new CallableRoutine();
        return $routine->getReadConnection()->query($sql)->fetchAll(PDO::FETCH_ASSOC);
    }

this is examle function.. use it as you want..

public static function getUsers($id = '') {
        $sql = "CALL `get_users`('$id');";
        return CallableRoutine::composeResultSet($sql);
    }