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 from within the array to be group other than 0 (zero). I tested some PHP comparison operators to meet my condition (!=, <>), but it didn’t work. I couldn’t find anything related to this in the documentation.
Will I have to ride a DQL for that reason?
I said a solution but I did not say if it is possible. As far as I know I think it is not possible to do it the way you want (I may be wrong). A while ago I also searched for a solution to solve this issue and could not find it. So I decided to use the query Builder same. If you find a solution don’t hesitate to share!
– sadaoyokoyama
I took the test you forwarded, just added the
->select(f)
and replaced the $group with 0 for the purpose of testing, returned no value to me... returnedSELECT f FROM ModuloFinanceiro\Entities\FinContaspagar f WHERE f.grupo <> 0
. Since there are several. Should I add one more condition?– Felipe Nunes
True, I copied from a code of my own and forgot to complete it with what was missing. Mal ai! I just didn’t understand what I meant by "Since there are several". Various conditions? Something else, the return of
return $qb->getQuery()->getResult();
wasSELECT f FROM ModuloFinanceiro\Entities\FinContaspagar f WHERE f.grupo <> 0
?– sadaoyokoyama
It worked here. If you had returned an error there, you would say to put 0(zero) in quotes because if you leave no quotes, the bank will understand that zero is a column of the table (at least it was so here).
– sadaoyokoyama