scalar() public method
Returns the query result as a scalar value.
The value returned will be the specified field in the first document of the query results.
public string scalar ( $field, $db = null ) | ||
---|---|---|
$field | string |
Name of the attribute to select |
$db | yii\elasticsearch\Connection |
The database connection used to execute the query. If this parameter is not given, the |
return | string |
The value of the specified attribute in the first record of the query result. Null is returned if the query result is empty or the field does not exist. |
Please login to continue.