joomla/joomla-cms — pull request #757 by amazeika (2013-03-06 09:28:07+00:00)
Title: Fixed event dispatching inconsistencies on some models leading to incomp...

# Reason

Incomplete API. We spotted inconsistencies on some component models which are not properly triggering events as expected. This results in an incomplete and inconsistent API for developers.

For example in our case we would like to be able to keep track of extension events, which is currently not possible.

# Problem

Some model’s methods are being overridden without calling their parent method. By not calling the parent the event dispatching process is being bypassed.

# Example

MenusModelItem::save does not trigger the before/after save events because it does not call its parent.

# Patch

This patch includes the following fixes and enhancements:

- This patch aims to solve the issue by properly taking care of the dispatching process on model actions.

- It also improves JModelAdmin a bit by reducing the amount of required code in some cases, e.g. extending JModelAdmin and wanting to trigger events on plugins other than content.

- We also made sure that the correct events (content/extension) are being triggered on each action for each extension resource in order to preserve consistency.

- Additionally event support was also added to com_config save actions.

Extreme care has been taken in order to provide full backwards compatibility. Patch has been tested extensively.

As a side note, the same problem is present on J!3.0. We would be more than happy to port this patch into the new code base so that this gets fixed over there as well..

Thanks in advance for considering this patch.