Page 1 of 1

Zend - error when trying to delete from database.

Posted: Mon Jul 23, 2012 4:38 am
by avibitton
Hi
im trying to make the tutorial of http://akrabat.com/zend-framework-tutorial/ its making an album , suppose to be easy one , but i guess i can mass it up ,
if some can help me understand what i was doing wrong it will be great .thanks in advanced .Avi.

in the step of delte album from this tutrial , im getting error as soon as i click on the delte action . thats the error :

An error occurred
Page not found
Exception information:

Message: Action "delete" does not exist and was not trapped in __call()
Stack trace:

#0 /var/www/_zend/library/Zend/Controller/Action.php(518): Zend_Controller_Action->__call('deleteAction', Array)
#1 /var/www/_zend/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('deleteAction')
#2 /var/www/_zend/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /var/www/_zend/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#4 /var/www/_zend/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#5 /var/www/contact/public/index.php(26): Zend_Application->run()
#6 {main}

Request Parameters:

array (
'controller' => 'index',
'action' => 'delete',
'id' => '1',
'module' => 'default',

Re: Zend - error when trying to delete from database.

Posted: Mon Jul 23, 2012 5:00 am
by requinix
You didn't implement a deleteAction() in your controller. You need to if you want to use it.

Re: Zend - error when trying to delete from database.

Posted: Mon Jul 23, 2012 5:04 am
by avibitton
it was in indexController but still im getting this error ,thats why i think its weird :

Code: Select all

public function delteAction()
    {
        // action body
        if ($this->getRequest()->isPost()) {
			$del = $this->getRequest()->getPost('del');
			if ($del == 'Yes') {
				$id = $this->getRequest()->getPost('id');
				$albums = new Application_Model_DbTable_Albums();
				$albums->deleteAlbum($id);
			}
			$this->_helper->redirector('index');
			} 
			else {
				$id = $this->_getParam('id', 0);
				$albums = new Application_Model_DbTable_Albums();
				$this->view->album = $albums->getAlbum($id);
			}
    	
    }

Re: Zend - error when trying to delete from database.

Posted: Mon Jul 23, 2012 5:22 am
by avibitton
i found the problem , i misspelled it, i wrote delteAction(missing "e" after the "l") and not deleteAction.
thank you very much .