PhalconPHP re-query/filter 结果

PhalconPHP re-query/filter result

在 PhalconPHP 中,我进行了如下查询:

$result = Model::callSomeModelFunction($param);

如何重新查询 $result,是否可能? :

$result = $result->filterOnceMoreWithNewParam($anotherParam);

或者我必须在第一行使用这个:

$result = Model::callSomeOtherModelFunction($param, $anotherParam);

如果 callSomeModelFunction returns 一个结果集,例如(Model::find('deleted = N') 然后你可以使用 ->filter

来自 resultsets 上的文档:

$filtered = $result->filter(function($individualRecord){
    if ($individualRecord->id < 3) {
        return $individualRecord;
    }
});

现在 $filtered 将是一个由 if 块内的过滤器缩小范围的结果集。