此外,我开始学习zend框架2.使用composel安装skillet应用程序。一切顺利,直到我没有开始阅读那一章http://framework.zend.com/manual/2.3/en/user-guide/forms-and-actions.html 部分我尝试在函数addAction()的控制器/src/Album/controller/AlbumController.php中创建新的类对象。
我的PHP错误: http://i63.fastpic.ru/big/2014/1201/93/9684e5bcc24b52fec546f07e90abe593.png
我的IDE:
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Album\Model\Album;
use Album\Form\AlbumForm; //COLORED RED "Form"
class AlbumController extends AbstractActionController
{
protected $albumTable;
public function indexAction()
{
return new ViewModel(array(
'albums' => $this->getAlbumTable()->fetchAll(),
));
}
public function addAction()
{
$form = new AlbumForm();
$form->get('submit')->setValue('Add');
$request = $this->getRequest();
if ($request->isPost()) {
$album = new Album(); //THE EEROR STRING THAT I GET IN PHP.
$form->setInputFilter($album->getInputFilter());
$form->setData($request->getPost());
if ($form->isValid()) {
$album->exchangeArray($form->getData());
$this->getAlbumTable()->saveAlbum($album);
// Redirect to list of albums
return $this->redirect()->toRoute('album');
}
}
return array('form' => $form);
}