Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make overrides of Mage_Core_Model_Resource_Db_Abstract::delete respect parent api #1257

Merged
merged 6 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions app/code/core/Mage/Admin/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ protected function _afterLoad(Mage_Core_Model_Abstract $user)
* Delete user role record with user
*
* @param Mage_Core_Model_Abstract $user
* @return bool
* @return $this
* @throws Exception
*/
public function delete(Mage_Core_Model_Abstract $user)
{
Expand All @@ -212,15 +213,13 @@ public function delete(Mage_Core_Model_Abstract $user)
$adapter->delete($this->getMainTable(), $conditions);
$adapter->delete($this->getTable('admin/role'), $conditions);
$adapter->commit();
} catch (Mage_Core_Exception $e) {
}
catch (Exception $e) {
$adapter->rollBack();
throw $e;
} catch (Exception $e) {
$adapter->rollBack();
return false;
}
$this->_afterDelete($user);
return true;
return $this;
}

/**
Expand Down
10 changes: 4 additions & 6 deletions app/code/core/Mage/Api/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $user)
* Delete the object
*
* @param Mage_Core_Model_Abstract $user
* @return boolean
* @return $this
* @throws Exception
*/
public function delete(Mage_Core_Model_Abstract $user)
{
Expand All @@ -247,14 +248,11 @@ public function delete(Mage_Core_Model_Abstract $user)
$dbh->delete($this->getTable('api/user'), array('user_id = ?' => $uid));
$dbh->delete($this->getTable('api/role'), array('user_id = ?' => $uid));
$dbh->commit();
} catch (Mage_Core_Exception $e) {
$dbh->rollBack();
throw $e;
} catch (Exception $e) {
$dbh->rollBack();
return false;
throw $e;
}
return true;
return $this;
}

/**
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Core/Model/Resource/Db/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public function forsedSave(Mage_Core_Model_Abstract $object)
*
* @param Mage_Core_Model_Abstract $object
* @return $this
* @throws Exception
*/
public function delete(Mage_Core_Model_Abstract $object)
{
Expand Down