Bonjour,
je suis entrain de faire le tutoriel Débuter avec Zend Framework 1.5 (approche MVC) et je bloque encore.
Lorsque je veux enregistrer les modification faites à un client voici les erreurs que j'ai :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
Strict Standards: Creating default object from empty value in C:\wamp\www\monAppli\application\controllers\IndexController.php on line 42
 
Fatal error: Call to undefined method stdClass::save() in C:\wamp\www\monAppli\application\controllers\IndexController.php on line 44
Voici le code de la fonction modifier:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
function modifierAction()
		{
			$this->view->nom = "Modifier un client";
			$form = new FormulaireClients();
			$form->submit->setLabel('Enregistrer');
			$this->view->form = $form;
			if ($this->_request->isPost()) {
				$formData = $this->_request->getPost();
				if ($form->isValid($formData)) {
					$clients = new Clients();
					$id = (int)$form->getValue('id');
					$row = $clients->fetchRow('id='.$id);
					$row->nom = $form->getValue('nom');
					$row->prenom = $form->getValue('prenom');
					$row->save();
					$this->_redirect('/');
				} else {
					$form->populate($formData);
				}
			} else {
			// L'id de l'album est attendu dans $params['id']
				$id = (int)$this->_request->getParam('id', 0);
				if ($id > 0) {
					$clients = new Clients();
					$client = $clients->fetchRow('id='.$id);
					$form->populate($client->toArray());
				}
			}
 
		}
Merci d'avance de votre aide