Multiple identifiers in In#5854
Conversation
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
@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: