> For the complete documentation index, see [llms.txt](https://metabolism.gitbook.io/symfony-wordpress-bundle/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://metabolism.gitbook.io/symfony-wordpress-bundle/reference/repository/userrepository.md).

# UserRepository

{% hint style="info" %}
[WP\_User\_Query](https://developer.wordpress.org/reference/classes/wp_user_query/) Wordpress wrapper to query objects
{% endhint %}

## Methods

#### count([$criteria](https://developer.wordpress.org/reference/classes/wp_user_query/#parameters))

Counts entities by a set of criteria.

#### find($id)

Finds an entity by its primary key / identifier.

#### findAll($orderBy)

Finds all public entities in the repository.

#### findBy([$criteria](https://developer.wordpress.org/reference/classes/wp_user_query/#parameters), $orderBy, $limit, $offset)

Finds entities by a set of criteria.

#### findOneBy([$criteria](https://developer.wordpress.org/reference/classes/wp_user_query/#parameters), $orderBy)

Finds a single entity by a set of criteria.

#### findQueried()

Finds a single entity related to the main query

## Example

```php
public function pageAction(Post $post, UserRepository $userRepository)
{
  $context = [
    'post'=>$post,
    'subscribers'=>$userRepository->findBy(['role' => 'subscriber'],['email'=>'ASC'], 3)
  ];
  
  return $this->render('single.html.twig', $context);
}
```
