我必须显示3个biens的预订表它应该显示3行3预订,但它只显示我一行 在控制器中
public function index_hote() {
$this->Reservation->recursive = 1;
$this->loadModel("BiensPersonne");
if($this->Session->read('Auth.User.0.Personne.id')){
$options = $this->BiensPersonne->findByPersonneId($this->Session- >read('Auth.User.0.Personne.id'));
$this->loadModel("Personne");
$biens=$this->Personne->findById( $options['BiensPersonne']['personne_id']);
foreach ($biens['Bien'] as $bien) {
$reservations=$this->Reservation- >find('all',array('conditions'=>array('Reservation.idBien'=> $bien['idBien'])));
Debugger::dump($reservations);
$this->paginate('Reservation');
$this->set('reservations', $reservations);
}}}
视图中的
<?php foreach ($reservations as $reservation): ?> <tr>
<td><?php echo h($reservation['Reservation']['dateReserDu']); ?></td>
<td><?php echo h($reservation['Reservation']['dateReserAu']); ?> </td>
<td><?php echo h($reservation['Reservation']['montantAPaye']); ?></td>
<td><?php echo h($reservation['Reservation']['etatReservation']); ?> </td>
</tr> <?php endforeach ?>
如果我调试重新启动它会告诉我这个
array(
(int) 0 => array(
'Reservation' => array(
'idReser' => '1',
'dateReserDu' => '2016-04-23',
'dateReserAu' => '2016-04-27',
'montantAPaye' => '500',
'etatReservation' => 'attente',
'iddev' => '0',
'idBien' => '9',
'id' => '24'
),
'Personne' => array(
'login' => '*****',
'id' => '24',
'designation' => 'client',
'nom' => 'mohamed',
'prenom' => 'jmaa',
'dateNaiss' => '1991-07-22',
'adresse' => 'rue paris',
'telFixe' => '26119945',
'telMobile1' => '95632114',
'telMobile2' => '98745213',
'email' => 'wahibaml@gmail.com',
'mdp' => '26111991',
'lienPhotoPersonnel' => 'sou.jpg',
'idVille' => '14'
),
'Device' => array(
'iddev' => null,
'nomdev' => null,
'logodev' => null,
'coefficient' => null
),
'Bien' => array(
'idBien' => '9',
'designBien' => 'maison pour couple',
'aPropos' => 'grand maison',
'capaciteAccueil' => '5',
'nbSalleBain' => '1',
'nbChambre' => '3',
'nbLits' => '5',
'description' => 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh',
'adresse' => 'rue ladikiya',
'immeuble' => 'zitouna',
'affichable' => false,
'affichablePageAccueil' => false,
'idtypelogement' => '1',
'idVille' => '1',
'idPays' => '1',
'idTypeBien' => '1',
'posLat' => '36.4236',
'posLong' => '10.6088'
)
)
)
array(
(int) 0 => array(
'Reservation' => array(
'idReser' => '3',
'dateReserDu' => '2016-04-08',
'dateReserAu' => '2016-04-29',
'montantAPaye' => '700',
'etatReservation' => 'attente',
'iddev' => '0',
'idBien' => '21',
'id' => '24'
),
'Personne' => array(
'login' => '*****',
'id' => '24',
'designation' => 'client',
'nom' => 'mohamed',
'prenom' => 'jmaa',
'dateNaiss' => '1991-07-22',
'adresse' => 'rue paris',
'telFixe' => '26119945',
'telMobile1' => '95632114',
'telMobile2' => '98745213',
'email' => 'wahibaml@gmail.com',
'mdp' => '26111991',
'lienPhotoPersonnel' => 'sou.jpg',
'idVille' => '14'
),
'Device' => array(
'iddev' => null,
'nomdev' => null,
'logodev' => null,
'coefficient' => null
),
'Bien' => array(
'idBien' => '21',
'designBien' => 'appartement à louer',
'aPropos' => ' garnd appartement',
'capaciteAccueil' => '5',
'nbSalleBain' => '1',
'nbChambre' => '4',
'nbLits' => '5',
'description' => 'garnd appartement',
'adresse' => 'rue syrie',
'immeuble' => 'zitouna',
'affichable' => false,
'affichablePageAccueil' => false,
'idtypelogement' => '1',
'idVille' => '2',
'idPays' => '0',
'idTypeBien' => '2',
'posLat' => '0',
'posLong' => '0'
)
)
)
array(
(int) 0 => array(
'Reservation' => array(
'idReser' => '2',
'dateReserDu' => '2016-04-07',
'dateReserAu' => '2016-04-20',
'montantAPaye' => '500',
'etatReservation' => 'attente',
'iddev' => '0',
'idBien' => '22',
'id' => '24'
),
'Personne' => array(
'login' => '*****',
'id' => '24',
'designation' => 'client',
'nom' => 'mohamed',
'prenom' => 'jmaa',
'dateNaiss' => '1991-07-22',
'adresse' => 'rue paris',
'telFixe' => '26119945',
'telMobile1' => '95632114',
'telMobile2' => '98745213',
'email' => 'wahibaml@gmail.com',
'mdp' => '26111991',
'lienPhotoPersonnel' => 'sou.jpg',
'idVille' => '14'
),
'Device' => array(
'iddev' => null,
'nomdev' => null,
'logodev' => null,
'coefficient' => null
),
'Bien' => array(
'idBien' => '22',
'designBien' => 'appartement',
'aPropos' => 'grand appartement',
'capaciteAccueil' => '2',
'nbSalleBain' => '1',
'nbChambre' => '2',
'nbLits' => '2',
'description' => 'grand appartement',
'adresse' => 'ruen marsa',
'immeuble' => '',
'affichable' => false,
'affichablePageAccueil' => false,
'idtypelogement' => '1',
'idVille' => '1',
'idPays' => '1',
'idTypeBien' => '1',
'posLat' => '0',
'posLong' => '0'
)
)
)
但是在表中它只显示了一行 the table Plz我能做什么,错误是什么?