You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe it's not about this library but I'll ask. What is the best way to make repository methods to be possible to return both Array and Objects?
It's not a good idea to make two versions of one method (findBy() and findByAsArray()).
The second way I used before is bad too. I used setFetchMode() for the whole repository. It causes the promblems with unknown method result without knowing the context, IDE autocomplete and so on.
May be I just should use return $qb->getQuery() and then calls proper method in service or controller class?
$repository->findBy(/*...*/)->getArrayResult();
How to name such methods? findX() seems inappropriate.
Any other ideas?
The text was updated successfully, but these errors were encountered:
Maybe it's not about this library but I'll ask. What is the best way to make repository methods to be possible to return both Array and Objects?
It's not a good idea to make two versions of one method (
findBy()
andfindByAsArray()
).The second way I used before is bad too. I used
setFetchMode()
for the whole repository. It causes the promblems with unknown method result without knowing the context, IDE autocomplete and so on.May be I just should use
return $qb->getQuery()
and then calls proper method in service or controller class?How to name such methods? findX() seems inappropriate.
Any other ideas?
The text was updated successfully, but these errors were encountered: