Controller_Data_Array::getIdsFromConditions PHP Метод

getIdsFromConditions() публичный Метод

resolve all conditions
public getIdsFromConditions ( $rows, $conditions, $limit = null )
    public function getIdsFromConditions($rows, $conditions, $limit = null)
    {
        $withLimit = !is_null($limit) && (is_array($limit) && !is_null($limit[0]));
        if ($withLimit) {
            $max = is_null($limit[1]) ? $limit[0] : $limit[0] + $limit[1];
        }
        $ids = array();
        foreach ($rows as $id => $row) {
            if ($id === '__ids__') {
                continue;
            }
            $valid = true;
            foreach ($conditions as $c) {
                if (!$this->isValid($row, $c)) {
                    $valid = false;
                    break;
                }
            }
            if ($valid === true) {
                $ids[] = $id;
                if ($withLimit && isset($max) && count($ids) > $max) {
                    break;
                }
            }
        }
        if ($withLimit) {
            $ids = array_slice($ids, $limit[0], $limit[1]);
        }
        return $ids;
    }