-
Notifications
You must be signed in to change notification settings - Fork 8
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
[QUESTION] Create mapper-subselect #7
Comments
Does this begin to help? http://atlasphp.io/cassini/query/select.html#1-4-3-3 |
Thank you for the fast response. The problem is that we have 2 MapperSelects, not simple Select. When I wrote Again, thank you for your help. |
Ah, I think I see. Yes, that's a tricky problem. First, another suggestion, though it uses a JOIN proper and not a JOIN (SELECT ... AS) subselect. If you have defined relationships between the two mappers, you can do this: http://atlasphp.io/cassini/orm/direct.html#1-1-9-2 But I don't know that it suits your case. If it does not, then a question: Can you explain again why you feel it must be (or ought to be) a subselect instead of a typical JOIN ? |
I have json+api REST service. The attributes/relationships are previously definedin metadata and the queries are generated base on that metadata, in this case, using atlas. We define the base queries for each resource and when it's needed we join them. /* @var $atlas \Atlas\Orm\Atlas */
$select = $atlas->select(Docheader::class)
->whereEquals([
'docheader.status' => 3,
]); On other resource (details) we want to join we this query, so it only shows details of orders with status=3. |
How can I create, from a MapperSelect, another MapperSelect to use in a join on the main query?
Right now I'm creating the 2 MapperSelects separated, then turning the second into a string and passing the bindvalues by hand.
The problem is that the bindings values colide, from the use of bindinline on both.
Something like:
Results in:
Table1 has a relationship to table2, but instead of using a simple join, I want to use a subselect to keep separated scopes. This is useful especially because I'm reusing the 2nd select.
Thank you for the help.
The text was updated successfully, but these errors were encountered: