-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
if ($values instanceof Select) { | ||
if (is_array($identifier)) { | ||
$identifiers = $identifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed this
@Ocramius I have updated the code. I do not know why the build is failing? |
see travis build here https://travis-ci.org/zendframework/zf2/jobs/19323397 , there is trailing_spaces need to be fixed. you can fix trailing space by
|
@samsonasik I tried that. No luck! |
you need to define what "No luck" is. what error you found ? have you follow the Readme ? https://github.com/fabpot/PHP-CS-Fixer/blob/master/README.rst#usage |
@samsonasik I did exactly the same command as you said. And, then I committed and it displayed that no change was detected. That is |
@@ -23,8 +23,8 @@ class In implements PredicateInterface | |||
/** | |||
* Constructor | |||
* | |||
* @param null|string $identifier | |||
* @param array $valueSet | |||
* @param null|string $identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need to change to null|string|array, and the later line needs to change to array|Select, i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ralphschindler Thanks for pointing out that!
@samsonasik It was my mistake. I only run cs-fixer in |
After looking at this, I think I'd like to find a way to accomplish this without a "dynamic" specification. Primarily, this usage pattern would break the NotIn predicate. |
Hey @ojhaujjwal, the solution you proposed looks to have a mutually exclusive condition where when the value is select, the identifier is processed as an array. I've made a different PR that will treat the identifier and values separately when processing them for the expression data, it is located here: https://github.com/ralphschindler/zf2/tree/feature/5854-alternative Can you tell me if this works for you? |
Merge branch 'feature/5854-alternative' into develop * feature/5854-alternative: Zend\Db\Sql\Predicate\In & NotIn * Changed specification so that it would work with NotIn * Modified the IN with select solution to include edge cases where the array of identifiers and select as a value are processed independent of one another. CS fixes Removed trailing spaces Update In.php CS fixes Update In.php Fixed alignment Removed trailing spaces Updated Tests of identifier array Now, identifier can also be array
Merged to develop. |
I have an SQL query like this:
SELECT * FROM data da INNER JOIN device_configuration d ON d.id = da.device_id WHERE (da.device_id, da.recorded_time) IN ( SELECT device_id, MAX(recorded_time) FROM data group BY device_id ) AND d.parent_id IS NULL;
Yes, you are right, it is not supported directly by Zend Framework 2.
With this PR, you can do something like:
So, the above query can be written in Zend Framework 2 as: