Repository navigation
Accept a bare Select in Predicate::in() and notIn() - #270
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The fluent in() and notIn() typed their value set as array|ArgumentInterface, so passing a Select for an IN (subquery) raised a TypeError, although the In and NotIn predicates they build accept a Select and wrap it in Argument\Select themselves. Widen both signatures to array|Select|ArgumentInterface to match In::__construct(), and update the Predicate API listing in the docs. The parameter parity test now also covers notIn()'s value set. Fixes php-db#266 Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
simon-mundy
force-pushed
the
fix/266-in-bare-select
branch
from
December 1, 2026 02:39
6f0cb54 to
b24b73f
Compare
tyrsson
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #266
Problem
Predicate::in()andnotIn()type their value set asarray|ArgumentInterface, so->where->in('id', $select)is aTypeError. TheInandNotInpredicates they build already accept a bareSelectand wrap it inArgument\Select, and laminas-db documentedarray|Selectfor the value set.Fix
in()andnotIn()takearray|Select|ArgumentInterface, matchingIn::__construct().PredicateAPI listing inwhere-having.mdshows the new signatures.notIn()'s value set.What stays the same
InandNotInalready wrap theSelect.Argument\Selectexplicitly works as before and produces identical SQL.Tests
PredicateTest, over both methods: a bareSelectrenders the subquery, gives the same SQL and the same prepared parameters (:subselect1where1) as theArgument\Selectform, and is stored as anArgument\Select.TypeErrorwithout the fix. Unit suite: 2885 tests pass.mago lintis clean andmago analyzereports nothing new.