Search code examples
phpcodeignitercodeigniter-2codeigniter-datamapper

codeIgniter Datamapper Get Only Query Results


I want to save results to cache but datamapper result objects is huge array.

I want to get only my query results without other data that referenced codeigniter data (models/configs/languages/etc..)

How can do this?

I searched on SO, internet and manual page (http://datamapper.wanwizard.eu/) but i couldnt find anything..


Solution

  • If you just want to access the core information about your records, try using the array extension here: http://datamapper.wanwizard.eu/pages/extensions/array.html

    This allows you to run something like:

    $objects-> all_to_array();
    

    ... which returns an array of objects, with all properties, but without the models/configs/languages &c. that you mention.