findBy Doctrine

3

I would like to ask a question, I am using the command to make a filter:

$FinContaspagar = $em->getRepository(FinContaspagar::class)->findBy(array('grupo' => '0'));

However, I would like the condition inside the array to be group other than 0 ( zero ). I tested some PHP comparison operators to meet my condition (! = , < > ), but it did not work. I did not find anything related to this in the documentation.

Will I have to mount a DQL for this?

    
asked by anonymous 11.04.2017 / 22:27

1 answer

3

EDITED

Dude, in that case I would go from createQueryBuilder.

I would stay:

$qb = $em->createQueryBuilder()->from(FinContaspagar::class, 'f');

$qb->select('f');

$qb->where($qb->expr()->neq('f.grupo', $grupo));

return $qb->getQuery()->getResult();
    
12.04.2017 / 02:15