public function executeDeleteFromTransaction(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($document = DocumentTable::getInstance()->find(array($request->getParameter('id'))), sprintf('Object document does not exist (%s).', $request->getParameter('id'))); $this->checkAuthorisation($document->getAsso()); $transaction = $document->getTransaction(); $document->deleteAndUnlink(); $this->redirect('transaction_show', $transaction); }
public function executeShow(sfWebRequest $request) { $this->transaction = $this->getRoute()->getObject(); $this->checkAuthorisation($this->transaction->getAsso()); $this->documents = DocumentTable::getInstance()->getAllForTransaction($this->transaction)->execute(); $document = new Document(); $document->asso_id = $this->transaction->getAssoId(); $document->transaction_id = $this->transaction->getPrimaryKey(); $this->form = new DocumentForm($document); $this->getResponse()->setSlot('current_asso', $this->transaction->getAsso()); }
public function getAllForTransaction($transaction) { $q = DocumentTable::getInstance()->createQuery('q')->where('q.transaction_id = ?', $transaction->getPrimaryKey()); return $q; }