リチウムフレームワーク(0.10)を使用して編集フォームを作成しようとしています。MySQLをDBMSとして使用しています。コントローラは次のようになります。
public function edit() {
$success = false;
$data = Posts::find(42);
return compact('data');
}
ビューファイル:
<?=$this->form->create(); ?>
<?=$this->form->field('title');?>
<?=$this->form->field('body', array('type' => 'textarea'));?>
<?=$this->form->submit('Add Post'); ?>
<?=$this->form->end(); ?>
<?php if ($success): ?>
<p style="color: red;">Post Successfully Saved</p>
<?php endif; ?>
サイトを呼び出すと、次のエラーメッセージが表示されます。
Fatal error: Cannot use object of type lithium\data\entity\Record as array in /var/www/web/frameworks/lithium-0.10/app/resources/tmp/cache/templates/template_views_posts_edit.html_483_1313415231_358.php on line 2
私は何が間違っているのですか?リチウムで編集フォームを作成する正しい方法は何ですか?残念ながら、これに関する情報は公式のリチウムドキュメントにはありません。