yii\db\ActiveQueryInterface::one PHP Method

one() public method

Executes query and returns a single row of result.
public one ( Connection $db = null ) : yii\db\ActiveRecordInterface | array | null
$db Connection the DB connection used to create the DB command. If `null`, the DB connection returned by [[ActiveQueryTrait::$modelClass|modelClass]] will be used.
return yii\db\ActiveRecordInterface | array | null a single row of query result. Depending on the setting of [[asArray]], the query result may be either an array or an ActiveRecord object. `null` will be returned if the query results in nothing.
    public function one($db = null);