<p>This is People table records.</p>
<?=$this->Form->create($entity,
['type'=>'post',
'url'=>['controller'=>'Messages',
'action'=>'index']]) ?>
<fieldset class="form">
person id
<?= $this->Form->error('Messages.person_id'); ?>
<?= $this->Form->text('Messages.person_id'); ?>
Message
<?= $this->Form->error('Messages.message'); ?>
<?= $this->Form->text('Messages.message'); ?>
<?= $this->Form->submit('投稿') ?>
</fieldset>
<?=$this->Form->end() ?>
<hr>
<table>
<thead>
<tr><th>ID</th><th>Message</th><th>name</th><th>created at</th>
</tr>
</thead>
<?php foreach($data->toArray() as $obj): ?>
<tr>
<td><?=h($obj->id) ?></td>
<td><?=h($obj->message) ?></td>
<td><?=h($obj->person->name) ?></td>
<td><?=h($obj->created_at) ?></td>
</tr>
<?php endforeach; ?>
</table>
<p>This is People table records.</p>
<?=$this->Form->create(null, ["type"=>"post", "url"=>["controller"=>"People", "action"=>"index"]]) ?>
<div>find</div>
<div><?=$this->Form->text("People.find") ?></div>
<div><?=$this->Form->submit("検索") ?></div>
<?=$this->Form->end() ?>
<table>
<thead><tr>
<th>id</th><th>name</th><th>messages</th>
</tr></thead>
<?php foreach($data->toArray() as $obj): ?>
<tr>
<td><?=h($obj->id) ?></td>
<td><a href="<?=$this->Url->build(["controller"=>"People", "action"=>"edit"]); ?>?id=<?=$obj->id ?>"><?=h($obj->name) ?></a></td>
<td><?php foreach($obj->messages as $item): ?>
"<?=h($item->message) ?>"<br>
<?php endforeach; ?></td>
<td><?=h($obj->age) ?></td>
<td><a href="<?=$this->Url->build(["controller"=>"People", "action"=>"delete"]); ?>?id=<?=$obj->id ?>">delete</a></td>
</tr>
<?php endforeach; ?>
</table>