Skip to content

Commit

Permalink
Make overrides of Mage_Core_Model_Resource_Db_Abstract::delete respec…
Browse files Browse the repository at this point in the history
…t parent api (#1257)

* Make overrides of Mage_Core_Model_Resource_Db_Abstract::delete to respect parent api

* switch Exception to Throwable

* Switched Exception to Throwable

* typo

* Update README.md

Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
Co-authored-by: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 11, 2022
1 parent bc4b2cd commit 61f1a22
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
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

0 comments on commit 61f1a22

Please sign in to comment.