/** * Delete row from database that matches this object's $id. * Also, delete the associated document in filecabinet. */ public function delete() { \PHPWS_Core::initModClass('filecabinet', 'Document.php'); \PHPWS_DB::begin(); $db = self::getDb(); $db->addWhere('id', $this->id); $result = $db->delete(); if (\PHPWS_Error::logIfError($result)) { \PHPWS_DB::rollback(); return FALSE; } $doc = new \PHPWS_Document($this->document_fc_id); $result = $doc->delete(); if (\PHPWS_Error::logIfError($result)) { \PHPWS_DB::rollback(); return FALSE; } \PHPWS_DB::commit(); return TRUE; }