/** * Executes query and returns all results as an array. * * @param ConnectionInterface $connection the DB connection used to create the DB command. * If null, the DB connection returned by {@see \rock\db\ActiveQueryTrait::modleClass()} will be used. * @return array|ActiveRecord[] the query results. If the query results in nothing, an empty array will be returned. */ public function all(ConnectionInterface $connection = null) { // event before /** @var ActiveRecord $model */ $model = new $this->modelClass(); if (!$model->beforeFind()) { return []; } return parent::all($connection); }