yii\db\Query::all PHP Method

all() public method

Executes the query and returns all results as an array.
public all ( Connection $db = null ) : array
$db Connection the database connection used to generate the SQL statement. If this parameter is not given, the `db` application component will be used.
return array the query results. If the query results in nothing, an empty array will be returned.
    public function all($db = null)
    {
        if ($this->emulateExecution) {
            return [];
        }
        $rows = $this->createCommand($db)->queryAll();
        return $this->populate($rows);
    }

Usage Example

Example #1
0
 public static function getUsersModulesList()
 {
     $query = new Query();
     $query->select('modules.*,users_modules.user_id as active')->from('modules')->join('left join', 'users_modules', 'modules.id = users_modules.module_id and
             users_modules.user_id= ' . Yii::$app->user->id)->orderBy('modules.id');
     return $query->all();
 }
All Usage Examples Of yii\db\Query::all