Feature PR-5.0-dev b/c break PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
22 Dec 2022

Pull Request for Issue #39372 .

Summary of Changes

As pointed out in the issue our immutable event is very mutable. This fixes all the cases so that once initialised there can be no properties set into the event (it’s possible we might need some plug-in events to actually be mutable).

As we've now split the Immutable class from the mutable class - I've taken this opportunity to move the create method to it's own factory class - because it will be somewhat confusing for users that the mutable AbstractEvent class can create AbstractImmutable class's which are somewhat unrelated.

Testing Instructions

Ensure core continues to work when performing a variety of actions. We also should test this with some 3rd party plugins to ensure they also still work.

Actual result BEFORE applying this Pull Request

Event is mutable

Expected result AFTER applying this Pull Request

Event is not mutable

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 22 Dec 2022
Category Libraries
avatar wilsonge wilsonge - open - 22 Dec 2022
avatar wilsonge wilsonge - change - 22 Dec 2022
Status New Pending
avatar wilsonge wilsonge - change - 22 Dec 2022
Title
Make abstract immutable event actually immutable
[5.0] Make abstract immutable event actually immutable
avatar wilsonge wilsonge - edited - 22 Dec 2022
avatar wilsonge wilsonge - change - 22 Dec 2022
The description was changed
avatar wilsonge wilsonge - edited - 22 Dec 2022
avatar richard67
richard67 - comment - 25 Dec 2022

@SharkyKZ Why confused? Because of what the PR does? Or because it's for 5.0?

avatar SharkyKZ
SharkyKZ - comment - 29 Dec 2022

@SharkyKZ Why confused? Because of what the PR does? Or because it's for 5.0?

Because it doesn't make much sense for this immutable class to extend a class that is explicitly mutable. Any change here is going to be a B/C break anyways so might as well fix the inheritance tree.

avatar wilsonge wilsonge - change - 29 Dec 2022
Labels Added: PR-5.0-dev
avatar joomla-cms-bot joomla-cms-bot - change - 29 Dec 2022
Category Libraries Administration com_content Modules Libraries Front End Plugins
avatar wilsonge
wilsonge - comment - 29 Dec 2022

Because it doesn't make much sense for this immutable class to extend a class that is explicitly mutable. Any change here is going to be a B/C break anyways so might as well fix the inheritance tree.

That's a fair shout. The framework class is final so couldn't extend from there but implemented as similar now

If this PR is accepted I'll do a PR to migrate the EventFactory creation back to the 4.x CMS tree

avatar wilsonge
wilsonge - comment - 3 Jan 2023

@SharkyKZ can you re-review please

avatar wilsonge wilsonge - change - 3 Jan 2023
The description was changed
avatar wilsonge wilsonge - edited - 3 Jan 2023
avatar HLeithner
HLeithner - comment - 7 Mar 2023

I'm not sure how useful it is to introduce a new class for a functionality which we should not use.
Every event should have it's own class and should be created directly without a factory. ymmv

avatar wilsonge
wilsonge - comment - 27 Jul 2023

Whilst the class exists it should do what it says on the tin :) yvmv :P

avatar HLeithner
HLeithner - comment - 31 Aug 2023

Is this PR now absolute after the all new events?

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar kernusr
kernusr - comment - 13 Mar 2024

In order to make the AbstractEventImmutable class true immutable, you disabled the ability to call setArgument after initialization. It's the right way! But what about methods addArgument, removeArgument, clearArguments?

avatar wilsonge wilsonge - change - 27 Mar 2024
Labels Added: Feature b/c break
avatar wilsonge wilsonge - change - 27 Mar 2024
Labels Added: PR-5.1-dev
avatar wilsonge
wilsonge - comment - 27 Mar 2024

@kernusr we're extending the frameworks' abstractEvent here now - so these methods don't exist at all

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.0] Make abstract immutable event actually immutable
[5.2] Make abstract immutable event actually immutable
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Make abstract immutable event actually immutable
[5.3] Make abstract immutable event actually immutable
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment