> 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/postrepository.md).

# PostRepository

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

## Methods

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

Count entities by a set of criteria.

#### find($id)

Find an entity by its primary key / identifier.

#### findAll($orderBy, $public=true)

Find all public entities in the repository.

#### findBy([$criteria](https://developer.wordpress.org/reference/classes/wp_query/#parameters), $orderBy, $limit, $offset) <a href="#findby" id="findby"></a>

Find a single entity related to the main query

**findByGuid($ids)**

Find entities by guid

#### findByState($state)

Find a single entity by its [state](/symfony-wordpress-bundle/guides/wp-steroids-plugin/page-states.md)

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

Find a single entity matching a set of criteria.

**findOneByGuid($id)**

Find one entity by guid

#### findPostTypes($args=\[], $output='names', $operator='and')

Gets a list of all registered post type objects.

#### findQueried()

Find entities matching a set of criteria.

## Example

```php
public function pageAction(Post $post, PostRepository $postRepository)
{
  $context = [
    'post'=>$post,
    'guides'=>$postRepository->findBy(['post_type'=>'guide'],['title'=>'ASC'], 3)
  ];
  
  return $this->render('single.html.twig', $context);
}
```
