? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
13 Feb 2018

Pull Request for Issue #19580.

Summary of Changes

Introduces a boot functionality for components where they can register services in a container instead of providing helper classes which get loaded magically. Consumer of these services can then boot a component first to make sure, that the services are loaded and get an instance of ComponentInterface.

On a long term, all the extensions should be bootable and provide an interface to their environment.

Testing Instructions

The instructions below do test the old JCategories::getInstance() code and the new one by booting the component.

  • Create a second category for articles
  • Create an article custom field
  • Open an article on the front end

Expected result

All should work as before.

Actual result

All should work as before.

Documentation Changes Required

The new service based approach needs to be documented.

avatar laoneo laoneo - open - 13 Feb 2018
avatar laoneo laoneo - change - 13 Feb 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2018
Category Administration com_content com_fields Front End Libraries
avatar laoneo laoneo - change - 13 Feb 2018
Labels Added: ?
7d7bc87 13 Feb 2018 avatar laoneo CS
avatar wilsonge
wilsonge - comment - 13 Feb 2018

Honestly I think that we keep ContentCategories here - the purpose of this was to remove guessing of path location - whilst still having the class - not removing the class altogether. So can we add it back for now please? Even if we end up removing it in a future refactor I want to figure out how it looks in this format :)

avatar laoneo
laoneo - comment - 13 Feb 2018

So can we add it back for now please

You mean in a namespaced way or the old way?

avatar mbabker
mbabker - comment - 13 Feb 2018

Well, a component with its own container doesn't have to follow a strict class naming convention (because the container will define where the service lives), whereas stuff using the legacy container would need to follow the old way. So, I think you could give it a properly namespaced class name since you're creating a container for com_content.

With that said though, since we support options setting in the constructor, we need to ensure the categories service isn't singleton in the container (i.e. it can't be a shared service). Otherwise you'll always get an object with the first object's options.

avatar laoneo
laoneo - comment - 13 Feb 2018

Added a content specific service class in 1a119fd.

avatar laoneo
laoneo - comment - 14 Feb 2018

I'v added an interface and trait to load the extensions and added it to the application.

avatar laoneo laoneo - change - 14 Feb 2018
Title
[4.0][WIP] Move component categories helper to services
[4.0] Move component categories helper to services
avatar laoneo laoneo - edited - 14 Feb 2018
27f89f2 14 Feb 2018 avatar laoneo CS
avatar laoneo
laoneo - comment - 14 Feb 2018

Removed the WIP. Would be good if @mbabker and @wilsonge can review it again. If all ok then I can move to the other services.

avatar laoneo
laoneo - comment - 14 Feb 2018

Or do we do some sort of NotSupported Exception type for these things rather than returning null?

At the moment it returns null. If we throw an exception, we always have to do a try/catch around it which would be for me overhead. I was even thinking about to return an empty array just to not always write another "if" check around the for loop.

9eadbb9 14 Feb 2018 avatar laoneo CS
ca128f7 15 Feb 2018 avatar laoneo CS
5a9912c 19 Feb 2018 avatar laoneo doc
avatar laoneo
laoneo - comment - 19 Feb 2018

Changed the service registering to a class. I would like to do the dispatcher in it's own pr.

avatar laoneo laoneo - change - 21 Feb 2018
The description was changed
avatar laoneo laoneo - edited - 21 Feb 2018
avatar wilsonge
wilsonge - comment - 1 Mar 2018

I think there's still quite a lot of tweaks to be made here - but this will do as a starting point :)

avatar wilsonge wilsonge - change - 1 Mar 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-03-01 21:23:14
Closed_By wilsonge
avatar wilsonge wilsonge - close - 1 Mar 2018
avatar wilsonge wilsonge - merge - 1 Mar 2018

Add a Comment

Login with GitHub to post a comment