Feature ? ? PR-5.0-dev b/c break Removal Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
18 Jan 2023

Summary of Changes

Replaces the state holder for model with a transition class which extends the Registry. Like that we benefit from the features of the Registry which is used across the whole core. It removes the dependency for the deprecated CMSObject class.

Testing Instructions

  • Create an article in the back end with the state published
  • Filter for trashed articles

Actual result BEFORE applying this Pull Request

No article is shown.

Expected result AFTER applying this Pull Request

No article is shown.

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: joomla/Manual#78 and joomla/Manual#77

  • No documentation changes for manual.joomla.org needed

189195b 16 Jan 2023 avatar laoneo tests
2d06614 18 Jan 2023 avatar laoneo type
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jan 2023
Category Libraries Unit Tests
avatar laoneo laoneo - open - 18 Jan 2023
avatar laoneo laoneo - change - 18 Jan 2023
Status New Pending
avatar laoneo laoneo - change - 18 Jan 2023
Title
[5.0] Transition from CMSObject to Regstry for modle state
[5.0] Transition from CMSObject to Registry for model state
avatar laoneo laoneo - edited - 18 Jan 2023
avatar laoneo laoneo - change - 18 Jan 2023
Labels Added: ? PR-5.0-dev
avatar joomla-cms-bot joomla-cms-bot - change - 24 Feb 2023
Category Libraries Unit Tests External Library Composer Change Libraries Unit Tests
avatar laoneo laoneo - change - 10 Mar 2023
Labels Added: Composer Dependency Changed ?
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2023
Category Libraries Unit Tests External Library Composer Change Libraries Unit Tests
a62bc42 22 Mar 2023 avatar laoneo cs
avatar laoneo laoneo - change - 22 Mar 2023
Labels Removed: Composer Dependency Changed
f4b1f8a 22 Mar 2023 avatar laoneo cs
avatar laoneo
laoneo - comment - 5 Apr 2023

@HLeithner what do we do here?

avatar HLeithner
HLeithner - comment - 6 Apr 2023

@laoneo tests are failing I restarted the tests and I think we will go with this solution. I added it to my personal todo list and hope to merge it this week after giving some thought again.

avatar laoneo
laoneo - comment - 6 Apr 2023

I guess the tests are failing because there is actually an issue there:
image

https://ci.joomla.org/artifacts/joomla/joomla-cms/5.0-dev/39663/system-tests/64369/screenshots/site/

avatar HLeithner
HLeithner - comment - 6 Apr 2023

Yes I thought the same I just wanted to be sure ;-) can you have a look?

avatar laoneo
laoneo - comment - 6 Apr 2023

It is actually a break when we switch to the registry. Because the registry returns the default value when the value in the internal data store is an empty string:

https://github.com/joomla-framework/registry/blob/2.0-dev/src/Registry.php#L207

While the CMSObject checks only if the property exists:

https://github.com/joomla/joomla-cms/blob/5.0-dev/libraries/src/Object/LegacyPropertyManagementTrait.php#L64

avatar HLeithner
HLeithner - comment - 6 Apr 2023

Ok can we make this b/c and trigger a deprecation warning before we are switching to registry?

avatar laoneo
laoneo - comment - 6 Apr 2023

Not sure if we really want to do 4e7ca12 ?

febd2d4 6 Apr 2023 avatar laoneo cs
avatar HLeithner
HLeithner - comment - 6 Apr 2023

https://github.com/joomla-framework/registry/blob/2.0-dev/src/Registry.php#L207 looks completely wrong...

Why in the word do we return the default value if value is an empty string? or NULL

we have a remove() function, shouldn't we only check for isset() ?
https://github.com/joomla-framework/registry/blob/2.0-dev/src/Registry.php#L607

avatar laoneo
laoneo - comment - 6 Apr 2023

I guess the issue is that this applies only when the separator is empty, otherwise it uses isset further down. If I read the code correctly.

avatar HLeithner
HLeithner - comment - 7 Apr 2023

Hmm, your work around works different because 0 empty too... can you point me to the code that had failed in the tests and why?

avatar laoneo
laoneo - comment - 7 Apr 2023

Here is direction set to an empty string https://github.com/joomla/joomla-cms/blob/5.0-dev/components/com_content/src/Model/FeaturedModel.php#L108 and here it gets the default value https://github.com/joomla/joomla-cms/blob/5.0-dev/components/com_content/src/Model/ArticlesModel.php#L634

The home site will imediately crash when you remove the fix, so you can debug it quickly as it will make then an ordering like a.ordering DESC ASC in the query.

avatar HLeithner
HLeithner - comment - 8 Apr 2023

ok then I think we need to keep the workaround and add documentation (and fix the cms) to use $state->remove() or is there anything that speaks against this?

avatar Fedik
Fedik - comment - 8 Apr 2023

Why in the word do we return the default value if value is an empty string? or NULL

As I understood, this is made for Form Fields default values, because Registry heavily used in Params, and form validation, filtering etc.
Kind of.

avatar HLeithner
HLeithner - comment - 8 Apr 2023

As I understood, this is made for Form Fields default values, because Registry heavily used in Params, and form validation, filtering etc. Kind of.

ok sounds wrong anyway

avatar laoneo
laoneo - comment - 13 Apr 2023

Where do you want to document what?

avatar HLeithner
HLeithner - comment - 14 Apr 2023

Where do you want to document what?

good question, one point would be the deprecation b/c part for joomla upgrades. On the other side we should mention this in the documentation of the model in the wiki? and the manual (doesn't exist yet?)

avatar laoneo laoneo - change - 11 May 2023
Labels Added: Feature b/c break Removal
avatar HLeithner HLeithner - change - 29 May 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-05-29 14:20:58
Closed_By HLeithner
avatar HLeithner HLeithner - close - 29 May 2023
avatar HLeithner HLeithner - merge - 29 May 2023
avatar HLeithner
HLeithner - comment - 29 May 2023

I merge this for now so we may get hopefully real world feedback in alpha 1.

Add a Comment

Login with GitHub to post a comment