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 all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Do not use 20.x.x if you need IE support.
- removed module `Mage_PageCache` [#2258](https://github.com/OpenMage/magento-lts/pull/2258)
- removed lib/flex containing unused ActionScript "file uploader" files [#2271](https://github.com/OpenMage/magento-lts/pull/2271)
- enabled website level config cache [#2355](https://github.com/OpenMage/magento-lts/pull/2355)
- make overrides of Mage_Core_Model_Resource_Db_Abstract::delete respect parent api [#1257](https://github.com/OpenMage/magento-lts/pull/1257)

For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0).

Expand Down
10 changes: 4 additions & 6 deletions app/code/core/Mage/Admin/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,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 @@ -206,15 +207,12 @@ 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 (Throwable $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 @@ -230,7 +230,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 @@ -241,14 +242,11 @@ public function delete(Mage_Core_Model_Abstract $user)
$dbh->delete($this->getTable('api/user'), ['user_id = ?' => $uid]);
$dbh->delete($this->getTable('api/role'), ['user_id = ?' => $uid]);
$dbh->commit();
} catch (Mage_Core_Exception $e) {
} catch (Throwable $e) {
$dbh->rollBack();
throw $e;
} catch (Exception $e) {
$dbh->rollBack();
return false;
}
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 @@ -509,6 +509,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