We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 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.


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

//$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);