<?php
class PublishersController extends AppController
{
public function index()
{
$this->set("publishers",
$this->Publisher->find("all", array('order' => 'company_name ASC')));
}
public function view($id = null)
{
$this->Publisher->id = $id;
$this->set('publisher', $this->Publisher->read());
}
function edit($id = null)
{
$this->Publisher->id = $id;
if (empty($this->data))
{
$this->data = $this->Publisher->findById($id);
}
else
{
if ($this->Publisher->save($this->data))
{
$this->Session->setFlash('Publisher Updated Successfully');
$this->redirect(array('action' => 'index'));
}
}
}
}
?>
答案 0 :(得分:5)
看起来你还没有加载Session类。
在AppController或PublisherController中,您需要添加以下内容:
public $components = array('Session');
那应该解决它。