src/EntitySpecificationRepositoryTrait.php
public function matchSingleResult($specification, ResultModifier $modifier = null)
    {
        $query = $this->getQuery($specification, $modifier);

        try {
            return $query->getSingleResult();
        } catch (NonUniqueResultException $e) {
            throw new Exception\NonUniqueResultException($e->getMessage(), $e->getCode(), $e);
        } catch (NoResultException $e) {
            throw new Exception\NoResultException($e->getMessage(), $e->getCode(), $e);
        }
    }
public function matchSingleResult($specification, ResultModifier $modifier = null)
    {
        $query = $this->getQuery($specification, $modifier);

        try {
            return $query->getSingleResult();
        } catch (NonUniqueResultException $e) {
            throw new Exception\NonUniqueResultException($e->getMessage(), $e->getCode(), $e);
        } catch (NoResultException $e) {
            throw new Exception\NoResultException($e->getMessage(), $e->getCode(), $e);
        }
    }
public function matchSingleResult ( $ specification , ResultModifier $ modifier = null ) { $ query = $ this -> getQuery ( $ specification , $ modifier ) ; try { return $ query -> getSingleResult ( ) ; } catch ( NonUniqueResultException $ e ) { throw new Exception \ NonUniqueResultException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } catch ( NoResultException $ e ) { throw new Exception \ NoResultException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Get single result when you match with a Specification.

@param Filter|QueryModifier $specification
@param ResultModifier|null  $modifier

@throw Exception\NonUniqueException  If more than one result is found
@throw Exception\NoResultException   If no results found

@return mixed
Get single result when you match with a Specification .