pb tuto zend mvc Call to a member function createRow() on a non-object
Salut,
Je bosse sur le tuto zend framework mvc de Guillaume Rossolini
Tout marche bien sauf quand je veux ajouter un titre
en cliquant sur le lien Ajouter un nouvel album:
http://localhost/zf-tutorial/index/ajouter
Voila l'erreur que j'obtiens:
Fatal error: Call to a member function createRow() on a non-object in E:\htdocs\www\zf-tutorial\application\controllers\IndexController.php on line 44
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
function ajouterAction()
{
$this->view->title = "Ajouter un nouvel album";
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$artist = $filter->filter($this->_request->getPost('artist'));
$artist = trim($artist);
$title = trim($filter->filter($this->_request->getPost('title')));
if ($artist != '' && $title != '') {
$data = array(
'artist' => $artist,
'title' => $title,
);
$album = new Album();
$album->insert($data);
$this->_redirect('/');
return;
}
}
// set up an "empty" album
$this->view->album = $album->createRow(); // <-- ligne 44
// additional view fields required by form
$this->view->action = 'ajouter';
$this->view->buttonText = 'Ajouter';
} |
Quelqu'un a t-il déjà eu cette erreur?
Merci d'avance!