# ServiceQuery

> Rejects incomplete paged results so partial directory reads cannot look like a completed synchronization.

[API reference](/docs/api/index.md) › [LDAP](/docs/extensions/ldap/reference/index.md) › ServiceQuery

| final class | `yii2\extensions\ldap\ServiceQuery` |
| --- | --- |
| Extends | `LdapRecord\Query\Builder` |
| Source | [`src/ServiceQuery.php`](https://github.com/yii2-extensions/ldap/blob/main/src/ServiceQuery.php#L20) |

Rejects incomplete paged results so partial directory reads cannot look like a completed synchronization.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`run()`](#method-run) | Runs an LDAP query and checks the server's paging response when paging is requested. | `ServiceQuery` |

## Method details

### run() <span id="method-run"></span>

```php
public function run(string $filter): mixed
```

Runs an LDAP query and checks the server's paging response when paging is requested.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$filter` | `string` | LDAP filter to execute. |

**Returns**

`mixed`: Native search result, unchanged when paging is not requested.

**Throws**

- [`DirectoryUnavailableException`](/docs/extensions/ldap/reference/directoryunavailableexception/index.md): if a requested page fails or does not carry a paging cookie.