当其他无缓冲查询在 Phalcon 中处于活动状态时无法执行查询

Cannot execute queries while other unbuffered queries are active in Phalcon

我从 Whosebug 和其他网站浏览了很多 post。以下是我几乎在所有网站上找到的解决方案,但它对我不起作用。 :-

     return new \Phalcon\Db\Adapter\Pdo\MySql(array(
            "host"     => 'XXXx',
            "username" => 'XXXX',
            "password" => 'XXXX',
            "dbname"   => 'XXXX',
            "options"  => array(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true)
        ));

我调用存储过程的代码:

    public function AssignPromoterToPromotionVenuAction($bookingSheetID = 0, $promoter_id = 0, $userID = 0)
    {
        $query = "CALL `x_wf_AgencyAssignPromoter`($bookingSheetID, $promoter_id, $userID)";
        $rp = new Promotion();
        return new Resultset(null, $rp, $rp->getReadConnection()->query($query));
    }

    public function RemovePromoterToPromotionVenuAction($bookingSheetID = 0, $promoter_id = 0, $userID = 0)
    {
        $query = "CALL `x_wf_AgencyRemovePromoter`($bookingSheetID, $promoter_id, $userID)";      
        $rp = new Promotion();
        return new Resultset(null, $rp, $rp->getReadConnection()->query($query));
    }

终于找到了解决方案:

您可以获取调用过程的结果,而不是返回结果集:

 return $rp->getReadConnection()->query($query)->fetchAll();

Ref Link