public function grabEntityFromRepository($entity, $params = [])
    {
        // we need to store to database...
        $this->em->flush();
        $data = $this->em->getClassMetadata($entity);
        $qb = $this->em->getRepository($entity)->createQueryBuilder('s');
        $qb->select('s');
        $this->buildAssociationQuery($qb, $entity, 's', $params);
        $this->debug($qb->getDQL());

        return $qb->getQuery()->getSingleResult();
    }
public function grabEntityFromRepository($entity, $params = [])
    {
        // we need to store to database...
        $this->em->flush();
        $data = $this->em->getClassMetadata($entity);
        $qb = $this->em->getRepository($entity)->createQueryBuilder('s');
        $qb->select('s');
        $this->buildAssociationQuery($qb, $entity, 's', $params);
        $this->debug($qb->getDQL());

        return $qb->getQuery()->getSingleResult();
    }
public function grabEntityFromRepository ( $ entity , $ params = [ ] ) { // we need to store to database... $ this -> em -> flush ( ) ; $ data = $ this -> em -> getClassMetadata ( $ entity ) ; $ qb = $ this -> em -> getRepository ( $ entity ) -> createQueryBuilder ( 's' ) ; $ qb -> select ( 's' ) ; $ this -> buildAssociationQuery ( $ qb , $ entity , 's' , $ params ) ; $ this -> debug ( $ qb -> getDQL ( ) ) ; return $ qb -> getQuery ( ) -> getSingleResult ( ) ; }
Selects a single entity from repository.
It builds query based on array of parameters.
You can use entity associations to build complex queries.

Example:

``` php
<?php
$user = $I->grabEntityFromRepository('User', array('id' => '1234'));
?>
```

@version 1.1
@param $entity
@param array $params. For `IS NULL`, use `array('field'=>null)`
@return object
Selects a single entity from repository . It builds query based on array of parameters . You can use entity associations to build complex queries .