[eluser]Alface[/eluser]
[quote author="jparent" date="1273495663"]Hi, I don't know if this question is solved, but I can't find the answere anywhere. When I use datamapper object in my apps and I want to show a query as a table I can't do somethink like:
$data = $dtmpper_obj->get()->all;
show_data_as_table($data);
I can't do that because in the table appears not only the data that I obtain in the select. Appears other fields of DataMapper main object, like prefixes, relationships,...
any solutions? Thanks![/quote]
You have 3 way to solve it..
Transfer the values to array before:
Code:
$array = array();
$dtmpper_obj->get();
foreach($dtmpper_obj->all as $value){
$data[] = $value;
}
show_data_as_table($data);
Sending your DMZ objet to your helper(function) and execute the same foreach there:
Code:
$dtmpper_obj->get();
show_data_as_table($dtmpper);
Or you can create a method on your DMZ class and call it like this (best way for me):
Code:
$dtmpper_obj->get();
$dtmpper_obj->show_data_as_table();