Beispiel #1
0
 public function delete($object)
 {
     // get database
     $db = $this->database;
     // update childrens parent category
     $query = "UPDATE " . $this->name . " SET parent=" . $object->parent . " WHERE parent=" . $object->id;
     $db->query($query);
     // delete category to item relations
     $this->app->category->deleteCategoryItemRelations($object->id);
     $result = parent::delete($object);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'category:deleted'));
     return $result;
 }
Beispiel #2
0
 public function delete($object)
 {
     // Check ACL
     if (!$object->isAdmin()) {
         throw new ApplicationTableException('Invalid Access Permissions');
     }
     // delete related categories
     $table = $this->app->table->category;
     $categories = $table->all(array('conditions' => array('application_id=?', $object->id)));
     foreach ($categories as $category) {
         $table->delete($category);
     }
     // delete related items
     $table = $this->app->table->item;
     $items = $table->all(array('conditions' => array('application_id=?', $object->id)));
     foreach ($items as $item) {
         $table->delete($item);
     }
     $result = parent::delete($object);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'application:deleted'));
     return $result;
 }
Beispiel #3
0
 public function delete($object)
 {
     // Check ACL
     if (!$object->canDelete()) {
         throw new ItemTableException('Invalid Access Permission');
     }
     // get database
     $db = $this->database;
     // delete item to category relations
     $query = "DELETE FROM " . ZOO_TABLE_CATEGORY_ITEM . " WHERE item_id = " . (int) $object->id;
     $db->query($query);
     // delete related comments
     $query = "DELETE FROM " . ZOO_TABLE_COMMENT . " WHERE item_id = " . (int) $object->id;
     $db->query($query);
     // delete related search data rows
     $query = "DELETE FROM " . ZOO_TABLE_SEARCH . " WHERE item_id = " . (int) $object->id;
     $db->query($query);
     // delete related rating data rows
     $query = "DELETE FROM " . ZOO_TABLE_RATING . " WHERE item_id = " . (int) $object->id;
     $db->query($query);
     // delete related tag data rows
     $query = "DELETE FROM " . ZOO_TABLE_TAG . " WHERE item_id = " . (int) $object->id;
     $db->query($query);
     $result = parent::delete($object);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'item:deleted'));
     return $result;
 }
Beispiel #4
0
 public function delete($object)
 {
     // delete related categories
     $table = $this->app->table->category;
     $categories = $table->all(array('conditions' => array('application_id=?', $object->id)));
     foreach ($categories as $category) {
         $table->delete($category);
     }
     // delete related items
     $table = $this->app->table->item;
     $items = $table->all(array('conditions' => array('application_id=?', $object->id)));
     foreach ($items as $item) {
         $table->delete($item);
     }
     $result = parent::delete($object);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'application:deleted'));
     return $result;
 }
Beispiel #5
0
 public function delete($object)
 {
     // get database
     $db = $this->database;
     $old_parent = $object->id;
     $new_parent = $object->parent_id;
     parent::delete($object);
     $query = "UPDATE " . $this->name . " SET parent_id = " . $new_parent . " WHERE parent_id = " . $old_parent;
     $result = $db->query($query);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'comment:deleted'));
     return $result;
 }
Beispiel #6
0
 public function delete($object)
 {
     // Check ACL
     if (!$object->canManageCategories()) {
         throw new CategoryTableException('Invalid Access Permissions');
     }
     // get database
     $db = $this->database;
     // update childrens parent category
     $query = "UPDATE " . $this->name . " SET parent=" . $object->parent . " WHERE parent=" . $object->id;
     $db->query($query);
     // delete category to item relations
     $this->app->category->deleteCategoryItemRelations($object->id);
     $result = parent::delete($object);
     // trigger deleted event
     $this->app->event->dispatcher->notify($this->app->event->create($object, 'categeory:deleted'));
     return $result;
 }