public static function all(array $where = [], string $table = "", bool $setRelations = true) : array
    {
        $query = new QueryBuilder(self::$_connection);
        $model = new static();

        $query->select("*");

        if($table === "") {
            $query->from($model->getTable());
        } else {
            $query->from($table);
        }

        $query = static::_setWhere($where, $query, $model->_primaryKey);

        $result = $query->execute();
        $return = [];

        foreach($result as $r) {
            $model = new static($r, $setRelations);
            if($table !== "") {
                $model->_table = $table;
            }

            $return[] = $model;
        }

        return $return;
    }
public static function all(array $where = [], string $table = "", bool $setRelations = true) : array
    {
        $query = new QueryBuilder(self::$_connection);
        $model = new static();

        $query->select("*");

        if($table === "") {
            $query->from($model->getTable());
        } else {
            $query->from($table);
        }

        $query = static::_setWhere($where, $query, $model->_primaryKey);

        $result = $query->execute();
        $return = [];

        foreach($result as $r) {
            $model = new static($r, $setRelations);
            if($table !== "") {
                $model->_table = $table;
            }

            $return[] = $model;
        }

        return $return;
    }
public static function all ( array $ where = [ ] , string $ table = "" , bool $ setRelations = true ) : array { $ query = new QueryBuilder ( self :: $ _connection ) ; $ model = new static ( ) ; $ query -> select ( "*" ) ; if ( $ table === "" ) { $ query -> from ( $ model -> getTable ( ) ) ; } else { $ query -> from ( $ table ) ; } $ query = static :: _setWhere ( $ where , $ query , $ model -> _primaryKey ) ; $ result = $ query -> execute ( ) ; $ return = [ ] ; foreach ( $ result as $ r ) { $ model = new static ( $ r , $ setRelations ) ; if ( $ table !== "" ) { $ model -> _table = $ table ; } $ return [ ] = $ model ; } return $ return ; }
Returns all records from database.

@param array  $where        Where clause array.
@param string $table        Table that will be used to get the records from.
@param bool   $setRelations Whether relations should be processed or not.

@return Model[] Records from database.
Returns all records from database .