User tests: Successful: Unsuccessful:
$model is undefined at line 140 for $this->postDeleteHook($model, $cid);, because $model was instantiated within the scope of the else block. If you try to delete an item from an admin list, you will get a PHP Notice and a PHP Catchable Fatal Error. So, it is better to declare/instantiate the model outside of the else block, within the same scope of the call to postDeleteHook().
Labels |
Added:
?
|
That's a good question. Logically, I concur that it would make more sense to move the hook, if we assume that the hook should only be called if the delete was successful. If that is the intended purpose of the hook call, then it should be placed in the if($model->delete($cid)) block, and the $model instantiation placed back in the else block.
Category | ⇒ | Libraries |
As it was resolved in another PR I am going to close this for now. It can always be re-opened if this approach is to be used instead
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-06-29 10:00:44 |
Closed_By | ⇒ | brianteeman |
Is there a reason we should call the post delete hook if there aren't any items deleted? i.e. should we move the hook inside the else?