/** * Deletes an attribute * */ public function deleteAction() { $attr = new Ot_Model_DbTable_CustomAttribute(); $attributeId = $this->_getParam('attributeId', null); if (is_null($attributeId)) { throw new Ot_Exception_Input('msg-error-attributeIdNotSet'); } $thisAttribute = $attr->get($attributeId); if ($this->_request->isPost()) { $where = $attr->getAdapter()->quoteInto('attributeId = ?', $attributeId); $attr->delete($where); $val = new Ot_Model_DbTable_CustomAttributeValue(); $val->delete($where); $logOptions = array('attributeName' => 'objectAttributeId', 'attributeId' => $attributeId); $this->_helper->log(Zend_Log::INFO, 'Attribute and all values were deleted', $logOptions); $this->_helper->messenger->addWarning($this->view->translate('msg-info-attributeDeleted', array($thisAttribute['label']))); $this->_helper->redirector->gotoRoute(array('controller' => 'custom', 'action' => 'details', 'key' => $thisAttribute['hostKey']), 'ot', true); } else { throw new Ot_Exception_Access('You can not access this method directly.'); } }
public function delete($hostParentId) { $model = new Ot_Model_DbTable_CustomAttributeValue(); $where = $model->getAdapter()->quoteInto('hostParentId = ?', $hostParentId) . ' AND ' . $model->getAdapter()->quoteInto('hostKey = ?', $this->getKey()); $model->delete($where); }