Welcome Guest, Not a member yet? Register   Sign In
Datamapper : One To Many
#7

[eluser]denis747[/eluser]
[quote author="WanWizard" date="1298235727"]Datamapper is object based, so every query starts from the current object.

What you want is not to get a single object, but all objects for a model, and for each of these objects, fetch all childs. This functionality is not in Datamapper because it would crash your application with an out-of-memory error very quickly, if it has to instantiate all those objects.

You need to "flatten" the result, as you would do with a normal JOIN query. That requires the include_related() method, but currently that is limited to $has_one relations. However, I don't think it breaks on a $has_many relation. You could try to comment the error message in line 4656, and use
Code:
$c = new Chain();
$c->include_related('restaurant')->get();
check_last_query();
[/quote]

In which file should I comment the error message? is it on the datamapper file stored in the application/libraries? Thanks,
Denis.


Messages In This Thread
Datamapper : One To Many - by El Forum - 02-19-2011, 04:09 PM
Datamapper : One To Many - by El Forum - 02-20-2011, 04:28 AM
Datamapper : One To Many - by El Forum - 02-20-2011, 09:02 AM
Datamapper : One To Many - by El Forum - 02-20-2011, 12:00 PM
Datamapper : One To Many - by El Forum - 02-20-2011, 04:02 PM
Datamapper : One To Many - by El Forum - 03-01-2011, 04:26 PM
Datamapper : One To Many - by El Forum - 04-10-2011, 05:06 AM
Datamapper : One To Many - by El Forum - 04-10-2011, 07:33 AM
Datamapper : One To Many - by El Forum - 04-10-2011, 12:12 PM
Datamapper : One To Many - by El Forum - 04-10-2011, 02:34 PM
Datamapper : One To Many - by El Forum - 04-11-2011, 01:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB