Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
BUG: refs #0355. Fix error when directly deleting an item
Browse files Browse the repository at this point in the history
We could do it when we were removing the item from the folder, or if we were
deleting its parent folder altogether, but simply calling the item's
deleteAction was throwing an exception.
  • Loading branch information
zachmullen committed Nov 16, 2011
1 parent 1fc0272 commit e82bb22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions core/models/base/ItemModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function __construct()
$this->_key = 'item_id';

$this->_mainData = array(
'item_id' => array('type' => MIDAS_DATA),
'name' => array('type' => MIDAS_DATA),
'description' => array('type' => MIDAS_DATA),
'item_id' => array('type' => MIDAS_DATA),
'name' => array('type' => MIDAS_DATA),
'description' => array('type' => MIDAS_DATA),
'type' => array('type' => MIDAS_DATA),
'sizebytes' => array('type' => MIDAS_DATA),
'date_creation' => array('type' => MIDAS_DATA),
Expand All @@ -33,10 +33,10 @@ public function __construct()
'download' => array('type' => MIDAS_DATA),
'privacy_status' => array('type' => MIDAS_DATA),
'uuid' => array('type' => MIDAS_DATA),
'folders' => array('type' => MIDAS_MANY_TO_MANY, 'model' => 'Folder', 'table' => 'item2folder', 'parent_column' => 'item_id', 'child_column' => 'folder_id'),
'revisions' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'ItemRevision', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
'itempolicygroup' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicygroup', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
'itempolicyuser' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicyuser', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
'folders' => array('type' => MIDAS_MANY_TO_MANY, 'model' => 'Folder', 'table' => 'item2folder', 'parent_column' => 'item_id', 'child_column' => 'folder_id'),
'revisions' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'ItemRevision', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
'itempolicygroup' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicygroup', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
'itempolicyuser' => array('type' => MIDAS_ONE_TO_MANY, 'model' => 'Itempolicyuser', 'parent_column' => 'item_id', 'child_column' => 'item_id'),
);
$this->initialize(); // required
} // end __construct()
Expand Down
2 changes: 1 addition & 1 deletion core/models/pdo/ItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function delete($itemdao)
$folders = $itemdao->getFolders();
foreach($folders as $folder)
{
$folder_model->removeItem($folder, $itemdao);
$this->database->removeLink('folders', $itemdao, $folder);
}

$revisions = $itemdao->getRevisions();
Expand Down

0 comments on commit e82bb22

Please sign in to comment.