public function deleteAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper('layout')->disableLayout(); if ($this->getRequest()->isPost()) { $id = $this->_getParam('id', 0); $purchaseorder = new Purchases_Model_DbTable_Purchaseorder(); $purchaseorder->deletePurchaseorder($id); $positions = $this->getPositions($id); $positionsDb = new Purchases_Model_DbTable_Purchaseorderpos(); foreach ($positions as $position) { $positionsDb->deletePosition($position->id); } } $this->_flashMessenger->addMessage('MESSAGES_SUCCESFULLY_DELETED'); }