przewiń do treści

Zend Framework od podstaw

Włodzimierz Gajda

public function deleterelationAction()
{
    $id = $this->getRequest()->getParam('id');
    $DbTable = new $this->_db_table_class;
    $obj = $DbTable->find($id)->current();
    if (!$obj) {
        throw new Zend_Controller_Action_Exception('Błędny adres!', 404);
    }
    $obj->deleteRelation();
    $obj->save();
    return $this->_helper->redirector(
        'edit',
        $this->getRequest()->getControllerName(),
        $this->getRequest()->getModuleName(),
        array('id' => $id)
    );
}

Listing 32.16. Metoda akcji deleterelation

Rozdział 32. Edycja zależności relacyjnych

listing-32-16.txt