Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Introduce category factory #20693

Merged
merged 32 commits into from
Sep 20, 2018
Merged

Conversation

laoneo
Copy link
Member

@laoneo laoneo commented Jun 8, 2018

As discussed on skype, moves the category instance creation code into a factory.

I'v also extended it with a new CategoryInterface class so we do not have to deal with the implementation class directly.

@laoneo
Copy link
Member Author

laoneo commented Aug 23, 2018

I need to get this one merged to finish the service conversion of com_contact, com_newsfeeds and com_categories.

@infograf768
Copy link
Member

I have tested this item ✅ successfully on 582fa3e

This PR here does not break more than is already broken (specially when concerning multilang routing in frontend (info-block).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20693.

@Hackwar
Copy link
Member

Hackwar commented Aug 25, 2018

I don't really want to name this CategoriesInterface. The whole category system is a tree implementation, which is why I implemented a node interface here: #21327 I don't know how to name it in the tree-object-sense, but maybe use something that more aligns with tree terminology, instead of focusing heavily on the categories stuff. In an ideal world, JMenu would implement the same interface and menu items become a NodeInterface object, too.

@laoneo
Copy link
Member Author

laoneo commented Aug 27, 2018

I agree for the tree, but the object which returns the tree is category related. So it makes sense to name it CategoryInterface. The implementation class should probably being renamed.

*/
public function get($id = 'root', $forceload = false)
public function get($id = 'root', $forceload = false): CategoryNode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is a b/c break for people who are subclassing JCategories and overriding this method.

Having said that I doubt people are overriding this method so it's probably ok. any thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, lets revert it then.

*
* @since __DEPLOY_VERSION__
*/
public function setOptions(array $options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want this in the interface? I think the options setting is specific to the implementation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the router you get a Category Injected and then you want to fetch the children with access check and without, so we need it there, or we inject there then the factory.

@laoneo
Copy link
Member Author

laoneo commented Sep 13, 2018

Can we get this merged @wilsonge so I can finish the service provider story?

@laoneo laoneo force-pushed the j4/category/factory branch from c4f66c1 to bda3a8b Compare September 18, 2018 04:33
@laoneo laoneo added this to the Joomla 4.0 milestone Sep 19, 2018
@laoneo laoneo merged commit 3e20363 into joomla:4.0-dev Sep 20, 2018
@laoneo laoneo deleted the j4/category/factory branch September 20, 2018 06:01
@wilsonge
Copy link
Contributor

I know it's annoyingly retrospective. But this looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants