-
-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
After upgrading from foundry v2.7.0 → v2.7.1, we noticed a breaking change in how findBy
handles array criteria.
Previously, passing an array of values for a field was translated into an IN()
query (expected behavior). Example (worked before):
$entities = SomeEntityFactory::findBy([
'status' => ['draft', 'published', 'archived'],
]);
This correctly generated:
SELECT e FROM App\Entity\SomeEntity e WHERE e.status IN (:status)
After v2.7.1, the same code now collapses the array into a single =
comparison instead of IN()
. The resulting DQL is:
SELECT e FROM App\Entity\SomeEntity e WHERE e.status = :status
This breaks a common use case where multiple values must be matched in one query. It also slows down test execution, since multiple queries are now required to achieve the same result.
Steps to Reproduce:
- Create several entities with different values for the same field.
- Call
Factory::findBy(['fieldName' => ['value1', 'value2']])
. - Observe that only a single value is used in the query instead of an
IN()
clause.
Expected Behavior:
findBy
should continue supporting field-value arrays and generate anIN()
query.
Impact:
- Breaks existing test setups relying on
findBy
with arrays. - Increases query count (slower tests).
- Forces manual workarounds.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working