I created an iterator for this. You'll need php5.
You can use it like this:
$resiter = new modelIterator("Reservation",$reservations);
foreach($resiter as $reservation) {
echo $reservation['id'];
echo $reservation['created'];
}
The class is very simple:
class modelIterator implements Iterator{
private $model;
private $array;
function __construct($model,$array) {
$this->model = $model;
$this->array = $array;
}
function current() {
$a = current($this->array);
return $a[$this->model];
}
function key() {
return key($this->array);
}
function next() {
next($this->array);
}
function rewind() {
reset($this->array);
}
public function valid() {
return (current($this->array) !== false);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---