-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select from Combine #230
Comments
Could you provide your Combine object so one can actually reproduce your error? |
Of course, here it is:
Below the results Instead I expect something like: |
Just realised I've never noticed your answer, I'm sorry. I am not sure what you want to achieve with this specific way of using unions but I think what you want to do is this: $select1 = new Select('articoli');
$select1->where->equalTo('id_articolo', 1);
$select2 = new Select('articoli');
$select2->where->equalTo('id_articolo', 2);
$select2->combine($select1);
$select3 = new Select('articoli');
$select3->where->equalTo('id_articolo', 3);
$select3->combine($select2);
$select = new Select();
$select->from(['i' => $select3]); Given your use case I think the following would make more sense, though: $select = new Select('articoli');
$select->where
->isEqualTo('id_articolo', 1)
->or
->isEqualTo('id_articolo', 2)
->or
->isEqualTo('id_articolo', 3); |
Bug Report
Summary
Writing the code below I obtain this error. If I create a workaround to class Combine, I obtain a wrong query like
SELECT * FROM "( (SELECT * FROM table1) UNION (SELECT * FROM table12 UNION (SELECT * FROM table3) ) "AS i
Current behavior
'PHP message: PHP Recoverable fatal error: Object of class Laminas\\Db\\Sql\\Combine could not be converted to string laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php
on line 75'How to reproduce
Expected behavior
I expect a query like SELECT * FROM ( (SELECT * FROM table1) UNION (SELECT * FROM table12 UNION (SELECT * FROM table3) ) AS i
The text was updated successfully, but these errors were encountered: