static protected function doctrine2Query(\Doctrine\ORM\EntityManager $entityManager, $entityName, $field, $generate)
    {
        $result = $entityManager->createQueryBuilder()
                                ->select("entity.$field")
                                ->from($entityName, 'entity')
                                ->where("entity.$field = :$field")
                                ->setParameter("$field", $generate)
                                ->getQuery()
                                ->getResult();
        
        return !empty($result);
    }
static protected function doctrine2Query(\Doctrine\ORM\EntityManager $entityManager, $entityName, $field, $generate)
    {
        $result = $entityManager->createQueryBuilder()
                                ->select("entity.$field")
                                ->from($entityName, 'entity')
                                ->where("entity.$field = :$field")
                                ->setParameter("$field", $generate)
                                ->getQuery()
                                ->getResult();
        
        return !empty($result);
    }
static protected function doctrine2Query ( \ Doctrine \ ORM \ EntityManager $ entityManager , $ entityName , $ field , $ generate ) { $ result = $ entityManager -> createQueryBuilder ( ) -> select ( "entity.$field" ) -> from ( $ entityName , 'entity' ) -> where ( "entity.$field = :$field" ) -> setParameter ( "$field" , $ generate ) -> getQuery ( ) -> getResult ( ) ; return ! empty ( $ result ) ; }
Doctgrine ORM v2 generate query

@param \Doctrine\ORM\EntityManager $entityManager
@param type $entityName
@param type $field
@param type $generate
@return mixed
Doctgrine ORM v2 generate query