私の見解では、次のようなHTMLテーブルが必要です。
COUNTRY TOWN
france paris
これは私の質問です:
$foo=$this->country->find('all', array(
'contain' => array(
'Town' => array(
'conditions' => array("Town.country_id = country.id"),
'fields' => array('id','name')
)
)
)
);
このように自分のビューに表示したい:
line6 <?php foreach ($diponibilite as $f): ?>
line7
line8 <tr>
line9 <td><?php echo $f['country']['name'];?></td>
line10 <td><?php echo $f['town']['name'];?></td>
line11
line12 </tr>
line13 <?php endforeach; ?>
モデル「国」と「町」は関連付けられています。
country hasmany town and town belongsto country
残念ながら、エラー:
注意(8):未定義のインデックス:名前[APP \ View \ index \ index.ctp、10行目]
なんで?