User tests: Successful: Unsuccessful:
Pull Request for Issue #19580.
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.
The instructions below do test the old JCategories::getInstance()
code and the new one by booting the component.
All should work as before.
All should work as before.
The new service based approach needs to be documented.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content com_fields Front End Libraries |
Labels |
Added:
?
|
So can we add it back for now please
You mean in a namespaced way or the old way?
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.
I'v added an interface and trait to load the extensions and added it to the application.
Title |
|
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.
Changed the service registering to a class. I would like to do the dispatcher in it's own pr.
I think there's still quite a lot of tweaks to be made here - but this will do as a starting point :)
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-01 21:23:14 |
Closed_By | ⇒ | wilsonge |
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 :)