src/ActiveQuery.php
public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return false;
        }
        return $this->one($db) !== null;
    }
public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return false;
        }
        return $this->one($db) !== null;
    }
Returns a value indicating whether the query result contains any row of data.
@param Connection $db the database connection used to execute the query.
If this parameter is not given, the `db` application component will be used.
@return bool whether the query result contains any row of data.