Exemple #1
0
 /**
  * Proxy the call to delete
  *
  * @param  string|object $table
  * @param string $where
  */
 public function delete($table, $where = '')
 {
     if (is_object($table)) {
         $where = 'id = ' . $table->id;
         if ($this->searchService != null) {
             $this->searchService->delete($table);
         }
         if ($this->tagService != null) {
             $this->tagService->deleteTags($table, za()->getUser());
         }
         if ($this->itemLinkService != null) {
             $this->itemLinkService->deleteItem($table);
         }
         $table = get_class($table);
     }
     $table = strtolower($table);
     $return = false;
     try {
         $this->beginTransaction();
         if (is_array($where)) {
             $where = $this->bindValues($where);
         }
         $this->proxied->delete($table, $where);
         $return = true;
         $this->commit();
     } catch (Exception $e) {
         error_log(get_class($e) . " - Caught: " . $e->getMessage());
         error_log($e->getTraceAsString());
         $this->rollBack();
         throw $e;
     }
     return $return;
 }