CodeIgniter Forums
stensi's Datamapper: how to get first record after ->all() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: stensi's Datamapper: how to get first record after ->all() (/showthread.php?tid=29848)



stensi's Datamapper: how to get first record after ->all() - El Forum - 04-23-2010

[eluser]marcello romani[/eluser]
Hallo,
I'm using stensi's DataMapper ORM.
How can I retrieve the first record of a dataset when I have called ->all ?
Example:

$p = new Project();
$p->get();
$dataset = $p->all

if (count($dataset) == 1) {
$first = $dataset[0]; // here lies the question
}


Thank you in advance.