? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
28 Dec 2018

This adds an interface for node objects. For now this only adds the interface, but these are supposed to be applied to CategoriesNode, MenuItem and a class for tags in the future. And of course wherever else they would fit.

avatar Hackwar Hackwar - open - 28 Dec 2018
avatar Hackwar Hackwar - change - 28 Dec 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2018
Category Libraries
avatar Hackwar Hackwar - change - 29 Dec 2018
Labels Added: ?
avatar rdeutz
rdeutz - comment - 29 Dec 2018

looks good me, maybe a getRoot function could make sense

avatar Hackwar
Hackwar - comment - 29 Dec 2018

Adding a getRoot method would mean that the objects need to know about the whole tree and not just their direct children and their parent. I'd like to keep it as simple as possible and each node by default would only need to know the bare minimum.

avatar rdeutz
rdeutz - comment - 29 Dec 2018

ok, then you have to use getParent() so often till you not get a parent. Is also a way to go.

avatar mbabker
mbabker - comment - 29 Dec 2018
public function getRoot(): object
{
    $root = $this->getParent();

    if (!$root) {
        return $this;
    }

    while ($root->getParent()) {
        $root = $root->getParent();
    }

    return $root;
}
avatar Hackwar
Hackwar - comment - 29 Dec 2018

So, is the consensus that you want such a getRoot method? I personally would want to keep it rather simple and leave such methods out which can be created with the other methods of the interface. But in any case, just say which way to go and I'll adapt it. It would just be nice to move forward with this.

avatar mbabker
mbabker - comment - 29 Dec 2018

Personally I'd say add it, getRoot() is a rather simple thing and a similar thing does exist in most other tree oriented packages I work with.

avatar Hackwar
Hackwar - comment - 30 Dec 2018

getRoot has been added. Can we simply merge this or do we need "testers"?

avatar rdeutz rdeutz - change - 4 Jan 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-01-04 15:45:08
Closed_By rdeutz
avatar rdeutz rdeutz - close - 4 Jan 2019
avatar rdeutz rdeutz - merge - 4 Jan 2019

Add a Comment

Login with GitHub to post a comment