? ? Pending

User tests: Successful: 0 Unsuccessful: 0

avatar laoneo
laoneo
25 Oct 2021

Pull Request for discussion #35396 (comment).

Summary of Changes

Injects a dispatcher into the MVC layer, so we can trigger the events trough it. It removes the need to use the static call on the Factory. A new helper function dispatchEvent is added to the BaseDatabaseModel and AbstractView which does a fallback to the global dispatcher when none is available. This is is handy as most of the events are sent out in models or views and it guarantees backwards compatibility when an extension uses the model or view outside of the MVC context.

Before you did

Factory::getApplication()->triggerEvent('myEvent', $event);

or

Factory::getApplication()->getDispatcher()->dispatch('myEvent', $event);

Now you can do

$this->getDispatcher()->dispatch('myEvent', $event);

or

$this->dispatchEvent($event);

Testing Instructions

  • Save an article.
  • Open an article on the front.

Actual result BEFORE applying this Pull Request

Works.

Expected result AFTER applying this Pull Request

Works.

avatar laoneo laoneo - open - 25 Oct 2021
avatar laoneo laoneo - change - 25 Oct 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 Oct 2021
Category Libraries
avatar laoneo laoneo - change - 25 Oct 2021
The description was changed
avatar laoneo laoneo - edited - 25 Oct 2021
avatar laoneo laoneo - change - 25 Oct 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 25 Oct 2021
Category Libraries Front End com_content Libraries
avatar laoneo laoneo - change - 25 Oct 2021
The description was changed
avatar laoneo laoneo - edited - 25 Oct 2021
avatar wilsonge
wilsonge - comment - 26 Oct 2021

I think this makes sense for controller and model - less so for the view.

avatar laoneo
laoneo - comment - 27 Oct 2021

As you can see, every details view, like the articles view, is triggering events. There are more the controllers which do not fir events.

avatar RickR2H RickR2H - test_item - 28 Oct 2021 - Tested successfully
avatar RickR2H
RickR2H - comment - 28 Oct 2021

I have tested this item successfully on 2a4c5c0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35899.

avatar joomdonation joomdonation - test_item - 29 Oct 2021 - Tested successfully
avatar joomdonation
joomdonation - comment - 29 Oct 2021

I have tested this item successfully on 2a4c5c0

Applied patch, save article, access to article, perform some batch actions (as changed in this PR) and it is still working. So the PR is working as described.

(I don't understand our event system good enough to confirm this is right or wrong, I just follow the testing instructions to test)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35899.

avatar alikon alikon - change - 29 Oct 2021
Status Pending Ready to Commit
avatar alikon
alikon - comment - 29 Oct 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35899.

avatar laoneo laoneo - change - 6 Nov 2021
Labels Added: ?
avatar laoneo
laoneo - comment - 16 Nov 2021

@bembelimen friendly reminder

avatar laoneo
laoneo - comment - 29 Nov 2021

@bembelimen friendly reminder

avatar bembelimen
bembelimen - comment - 30 Nov 2021

Could you please update your branch with the latest 4.1-dev, then I can merge it (I think you didn't check the checkbox that maintainer can do it).

avatar laoneo
laoneo - comment - 30 Nov 2021

DOne

avatar bembelimen bembelimen - change - 30 Nov 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-11-30 18:13:41
Closed_By bembelimen
avatar bembelimen bembelimen - close - 30 Nov 2021
avatar bembelimen bembelimen - merge - 30 Nov 2021
avatar bembelimen
bembelimen - comment - 30 Nov 2021

Thx

avatar PhilETaylor
PhilETaylor - comment - 4 Dec 2021

Somehow everyone missed that there is a completely undefined class in this PR... #36200
Screenshot 2021-12-04 at 18 45 20

Add a Comment

Login with GitHub to post a comment