Welcome Guest, Not a member yet? Register   Sign In
Datamapper include_related not extending result set columns

am using Datamapper and want to join all columns of a related table (1:1 relationship) in the result set. Hence, my code reads as follows:

$p = new Project();
$arrAll = $p->where("id <", 100)->where_related('outboundform', 'reference_type', 'project')->include_related('outboundform')->get()->all_to_array();

The query works, but no column of table 'outboundform' shows up in the result, they get completely ignored!! I just checked and the generated SQL reads:

SELECT `project` . * , `outboundform`.`id` AS outboundform_id, `outboundform`.`reference_type` AS outboundform_reference_type, `outboundform`.`reference_id` AS outboundform_reference_id, `outboundform`.`created` AS outboundform_created, `outboundform`.`updated` AS outboundform_updated, `outboundform`.`v1` AS outboundform_v1, `outboundform`.`v2` AS outboundform_v2, `outboundform`.`v3` AS outboundform_v3, `outboundform`.`v4` AS outboundform_v4, `outboundform`.`v5` AS outboundform_v5 FROM (`project`) LEFT OUTER JOIN `outboundform` outboundform ON `project`.`id` = `outboundform`.`reference_id` WHERE `project`.`id` <100 AND `outboundform`.`reference_type` = 'project' LIMIT 0 , 30

which is OK and gives me the correct result when executed. What's Datamappers problem here? Why is it not return the full amount of columns?

Messages In This Thread
Datamapper include_related not extending result set columns - by El Forum - 11-20-2012, 05:54 AM

Theme © iAndrew 2016 - Forum software by © MyBB