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 mo
Except that in this case the array is $reservations[ {n}
]['Reservation'] . You should only have ['Reservation'][ {n} ] when
that Reservation model is loaded indirectly through an associated
hasMany - ie where Person hasMany Reservation (recursive 1)
$people = Person->findAll() gives:
$people[
Grant Cox wrote:
> Using $reservation['Reservation']['number']; is correct. This is
> because each retrieved row may have associated models - ie
> $reservation['Room'] etc.
Ah, another chink of sunlight just broke through the clouds :-)
I was going to ask this same question myself. My workaro
OK, thank you!
Then I see the point ...
On Jan 10, 12:47 am, "Grant Cox" <[EMAIL PROTECTED]> wrote:
> Using $reservation['Reservation']['number']; is correct. This is
> because each retrieved row may have associated models - ie
> $reservation['Room'] etc.
--~--~-~--~~
Using $reservation['Reservation']['number']; is correct. This is
because each retrieved row may have associated models - ie
$reservation['Room'] etc.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Cake PHP" gro
Controller:
$this->set('reservations',$this->Reservation->findAll());
View:
foreach($reservations as $reservation) {
echo $reservation['Reservation']['number'];
}
Can I make this:
echo $reservation['number'] - instead?
I've tried foreach($reservations['Reservation']) bu