Chaos
Chaos

Reputation: 405

bypass findBy in symfony2 forcing lowercase as first letter

if I try to run this query in symfony2

$karte = $em->getRepository('CQIntranetBundle:Karte')->findByPGuId($pguid);

its returns

Entity 'CQ\IntranetBundle\Entity\Karte' has no field 'pGuId'. You can therefore not call 'findByPGuId' on the entities' repository

the field PGuID exist but the query try to look for pGuId is there a fix for this?

Upvotes: 0

Views: 373

Answers (1)

griotteau
griotteau

Reputation: 1822

You can override the method in the Karte repository :

public function findByPGuId($PGuId) {
   return $this->createQueryBuilder('k')
     ->where('k.PGuId= :PGuId')        
     ->setParameter('PGuId',$PGuId)      
     ->getQuery()
     ->getResult();                     
}

Upvotes: 1

Related Questions