Ejemplo n.º 1
0
 public function delete()
 {
     // сначала грохнем параметры подтовара
     $db = $this->getTable()->getAdapter();
     $where = array();
     $where[] = "subproduct_id = " . $this->id;
     $db->delete("subproduct_params_values", $where);
     return parent::delete();
 }
Ejemplo n.º 2
0
 function delete()
 {
     $model = new RM_Dependencies();
     $dependencies = $model->getDependencies($this);
     foreach ($dependencies as $row) {
         $row->delete();
     }
     parent::delete();
 }
Ejemplo n.º 3
0
 public function delete()
 {
     if ($this->task == self::JOB_TASK_IMPORT) {
         $params = $this->getParams();
         if (!@unlink($params['destination'] . '/' . $params['name'])) {
             throw new Zend_Db_Table_Row_Exception(_('Failed to delete file') . ' `' . $params['name'] . '`');
         }
     }
     return parent::delete();
 }
Ejemplo n.º 4
0
 /**
  * Delete action
  */
 public function deleteAction()
 {
     // Get the request object
     $request = $this->getRequest();
     // Check if the delete action is confirmed
     $confirm = intval($request->getParam('confirm', 0));
     $return = array();
     try {
         if ($this->_request->isXmlHttpRequest()) {
             if ($confirm === 1) {
                 // Delete the item
                 $this->_item->delete();
                 $return['result'] = true;
             } else {
                 throw new Zend_Controller_Action_Exception('Delete action is not confirmed');
             }
         } else {
             if ($confirm === 1) {
                 // Delete the item
                 $this->_item->delete();
                 $this->_flashMessenger->addMessage('Deleted the item succesfully.');
                 // Redirect to the index
                 $this->_redirect($this->_redirectUrlDeleteConfirm);
             } else {
             }
         }
     } catch (Exception $exception) {
         if ($this->_request->isXmlHttpRequest()) {
             $return['result'] = false;
             $return['message'] = $exception->getMessage();
         } else {
             $this->view->error = $exception->getMessage();
         }
     }
     if ($this->_request->isXmlHttpRequest()) {
         // Disable layout and view renderer
         $this->_helper->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         // Parse the years to the response object
         $this->_helper->json($return);
     }
 }
Ejemplo n.º 5
0
	public function delete($doAudit = true) {
		//Fire the before delete function
		if ($this->beforeDelete() === false) {
			return false;
		}
		
		$this->row->delete();

		// only unharvest if this item is harvested
		if ($this->harvestOnProcess) {
			$this->unharvest();
		}

		if ($doAudit) {
			$this->audit('Delete');
		}

		//Fire the after delete function
		$this->afterDelete();

		return true;
	}
Ejemplo n.º 6
0
 /**
  * Remove the model instance from the database.
  * NOTE: This method should not be overriden, use plugins instead where needed.
  *
  * @throws Opus_Model_Exception If a delete operation could not be performed on this model.
  * @return void
  */
 public function delete()
 {
     $this->_callPluginMethod('preDelete');
     $modelId = $this->getId();
     // if no primary key is set the model has
     // not been stored yet, so delete gets skipped
     if (null === $modelId) {
         return;
     }
     // Start transaction
     $dbadapter = $this->getTableRow()->getTable()->getAdapter();
     $dbadapter->beginTransaction();
     try {
         $this->_primaryTableRow->delete();
         $this->_primaryTableRow = null;
         $dbadapter->commit();
     } catch (Exception $e) {
         $dbadapter->rollback();
         $msg = $e->getMessage() . ' Model: ' . get_class($this);
         throw new Opus_Model_Exception($msg);
     }
     $this->_callPluginMethod('postDelete', $modelId);
 }
Ejemplo n.º 7
0
 /**
  * Delete a role from the database
  */
 public function delete()
 {
     $this->row->delete();
     return $this;
 }
Ejemplo n.º 8
0
 public function testTableRowExceptionBogusPrimaryKey()
 {
     $table = $this->_table['bugs_products'];
     $bogusData = array('bug_id' => 3, 'foo' => 'bar');
     $row = new Zend_Db_Table_Row(array('table' => $table, 'data' => $bogusData));
     try {
         $rowsAffected = $row->delete();
         $this->fail('Expected to catch Zend_Db_Table_Row_Exception');
     } catch (Zend_Exception $e) {
         $this->assertType('Zend_Db_Table_Row_Exception', $e, 'Expecting object of type Zend_Db_Table_Row_Exception, got ' . get_class($e));
         $this->assertEquals("The specified Table 'My_ZendDbTable_TableBugsProducts' does not have the same primary key as the Row", $e->getMessage());
     }
 }
Ejemplo n.º 9
0
 /**
  * Deletes this model response
  */
 public function delete()
 {
     $this->modelResponseRow->delete();
 }
Ejemplo n.º 10
0
 public function delete()
 {
     $tenant = $this->code;
     $result = parent::delete();
     $solr = OpenSKOS_Solr::getInstance()->delete('tenant:' . $tenant);
     return $result;
 }
Ejemplo n.º 11
0
 public function delete()
 {
     $collection_id = $this->id;
     $result = parent::delete();
     $solr = OpenSKOS_Solr::getInstance()->delete('collection:' . $collection_id);
     return $result;
 }
Ejemplo n.º 12
0
 /** Metoda nadpisana w celu czyszczenia cache'u
  *
  * @return int
  */
 public function delete()
 {
     $ret = parent::delete();
     $this->removeCache();
     return $ret;
 }