-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Zend/Db/Sql/Select - implements multiple combine statements #5142
Zend/Db/Sql/Select - implements multiple combine statements #5142
Conversation
* @param Select $select | ||
* @param string $type | ||
* @param string $modifier | ||
* @return Select |
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.
@return self
There's a lot going on in this PR to have so few details, is this a bug or a feature? And, if a bug, what is it attempting to solve? |
This PR is allow :
Current implementation allow only one |
Well, Postgresql does not support more than 2 sub-selects from being combined. That is one reason why Select was architected in the way it was. Mainly though, from the perspective of the API, all of the other methods talk about modifying the state of a particular Select, then allow the merging to an external separate Select. I think a way of building a Multi-UNION Select would be to create a new class called SelectUnion/SelectCombined, where the only api is SelectCombine->addSelect(Select $select, $mode); (with additional methods like perhaps union, unionAll, intersect, minus, etc). So basically, the new API would encourage this: $selectA = new Select()->from()->where();
$selectB = new Select()->from()->where();
$selectUnion = new SelectCombine('UNION');
$selectUnion->addSelect($selectA)->addSelect($selectB); instead of this: $selectA = new Select()->from()->where();
$selectB = new Select()->from()->where();
$selectA->combine($selectB); Thoughts? |
Good idea, but :
But your idea is good because we can simply auto order columns for order. |
I agree, |
For UNION statement columns should be ordered for all Select statements. |
* Create union clause | ||
* | ||
* @param Select $select | ||
* @param string $type |
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.
remove this @param string $type
, not at the function parameter.
@ralphschindler where does this stand in regards to milestone? 2.2.6? 2.3.0? later? |
@turrsis This is looking reasonable. Can you please add docblocks to all class methods? Once that's done, I can merge. |
@weierophinney docblocks added |
@weierophinney Can you merge this (docblocks added)? |
This feature needs documentation: opened an issue for that. |
…andalone functionality and is based on `AbstractSql`
…o `Zend\Db\Sql\Combine#combine()`
…tion messages, reverting `void` method return value (non-void)
Manually merged in 82504c2 Thanks! |
No description provided.