[5.0] Transition from CMSObject to Registry for model state#39663
[5.0] Transition from CMSObject to Registry for model state#39663HLeithner merged 25 commits intojoomla:5.0-devfrom
Conversation
|
@HLeithner what do we do here? |
|
@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. |
|
I guess the tests are failing because there is actually an issue there: https://ci.joomla.org/artifacts/joomla/joomla-cms/5.0-dev/39663/system-tests/64369/screenshots/site/ |
|
Yes I thought the same I just wanted to be sure ;-) can you have a look? |
|
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: While the CMSObject checks only if the property exists: |
|
Ok can we make this b/c and trigger a deprecation warning before we are switching to registry? |
|
Not sure if we really want to do 4e7ca12 😏 |
|
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 we have a |
|
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. |
|
Hmm, your work around works different because |
|
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. |
|
ok then I think we need to keep the workaround and add documentation (and fix the cms) to use |
As I understood, this is made for Form Fields default values, because Registry heavily used in Params, and form validation, filtering etc. |
ok sounds wrong anyway |
|
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?) |
|
I merge this for now so we may get hopefully real world feedback in alpha 1. |

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
CMSObjectclass.Testing Instructions
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: Document the new State class Manual#78 and Add deprecation for State object in favor of Registry Manual#77
No documentation changes for manual.joomla.org needed