public static function findAll($condition = '1=1', $params = array())
    {
        /* @var $condition \mpf\datasources\sql\ModelCondition */
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition')) {
            $condition = ModelCondition::getFrom($condition, get_called_class());
        } else {
            $condition->model = $condition->model ? $condition->model : get_called_class();
        }
        $condition->setParams($params);
        $searchedRelations = [];
        if (is_array($condition->with)) {
            foreach ($condition->with as $k) {
                $searchedRelations[$k] = $k;
            }
        }
        $models = static::getDb()->queryClass($condition, get_called_class(), $condition->getParams(), [
            [
                '_columns' => static::getDb()->getTableColumns(static::getTableName()),
                '_pk' => static::getDb()->getTablePk(static::getTableName()),
                '_isNewRecord' => false,
                '_action' => 'update',
                '_tableName' => static::getTableName(),
                '_db' => static::getDb(),
                '_searchedRelations' => $searchedRelations
            ]
        ]);
        if (!$models) {
            return [];
        }
        $condition->getExtraRelations($models);
        return $models;
    }
public static function findAll($condition = '1=1', $params = array())
    {
        /* @var $condition \mpf\datasources\sql\ModelCondition */
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition')) {
            $condition = ModelCondition::getFrom($condition, get_called_class());
        } else {
            $condition->model = $condition->model ? $condition->model : get_called_class();
        }
        $condition->setParams($params);
        $searchedRelations = [];
        if (is_array($condition->with)) {
            foreach ($condition->with as $k) {
                $searchedRelations[$k] = $k;
            }
        }
        $models = static::getDb()->queryClass($condition, get_called_class(), $condition->getParams(), [
            [
                '_columns' => static::getDb()->getTableColumns(static::getTableName()),
                '_pk' => static::getDb()->getTablePk(static::getTableName()),
                '_isNewRecord' => false,
                '_action' => 'update',
                '_tableName' => static::getTableName(),
                '_db' => static::getDb(),
                '_searchedRelations' => $searchedRelations
            ]
        ]);
        if (!$models) {
            return [];
        }
        $condition->getExtraRelations($models);
        return $models;
    }
public static function findAll ( $ condition = '1=1' , $ params = array ( ) ) { /* @var $condition \mpf\datasources\sql\ModelCondition */ if ( ! is_a ( $ condition , '\\mpf\\datasources\\sql\\ModelCondition' ) ) { $ condition = ModelCondition :: getFrom ( $ condition , get_called_class ( ) ) ; } else { $ condition -> model = $ condition -> model ? $ condition -> model : get_called_class ( ) ; } $ condition -> setParams ( $ params ) ; $ searchedRelations = [ ] ; if ( is_array ( $ condition -> with ) ) { foreach ( $ condition -> with as $ k ) { $ searchedRelations [ $ k ] = $ k ; } } $ models = static :: getDb ( ) -> queryClass ( $ condition , get_called_class ( ) , $ condition -> getParams ( ) , [ [ '_columns' => static :: getDb ( ) -> getTableColumns ( static :: getTableName ( ) ) , '_pk' => static :: getDb ( ) -> getTablePk ( static :: getTableName ( ) ) , '_isNewRecord' => false , '_action' => 'update' , '_tableName' => static :: getTableName ( ) , '_db' => static :: getDb ( ) , '_searchedRelations' => $ searchedRelations ] ] ) ; if ( ! $ models ) { return [ ] ; } $ condition -> getExtraRelations ( $ models ) ; return $ models ; }
Return all models that match the given condition.
@param string|ModelCondition $condition
@param array $params
@return static[]
Return all models that match the given condition .