Harro Verton wrote on Tuesday 31st of January 2012:We had this discussion before, and this implementation still doesn't make sense to me. There is a distinct difference between "Give me the first 10 results of Parents with Children" and "Give me the first 10 children with their parent info". As a developer, I know what output I want, and in most cases, it's the first one (typically used in paged lists), and not the second one. Which is the only one implemented at the moment.
The use case when you know exactly the number of children will be a pretty rare one to say the least, and would be doable with rows_limit() and rows_offset().Still, I can imagine it is strange for people (used to writing joins by hand or using a QB) in a case where you have 5 parents, each with 3 children, a limit of 10 would result in having 15 records returned (as the subquery with the limit is on the parents, which with a limit of 10 will return all 5 of them).
That's exactly what it is that this makes possible. The problem only arises when your where condition on the relation takes out some of the parents that were already limited.If (using this case as an example) you wanted a paginated list of volunteers with info about the team's there in, you can't make neat lists of 10 entries per page.
The decission whether or not to use a subquery is made in the following function: https://github.com/fuel/orm/blob/1.1/develop/classes/query.php#L832Do you have an example of how you implement that? I guess that would help people struggling with this issue.
It looks like you're new here. If you want to get involved, click one of these buttons!