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

Implemented naturalPrev function in Hierarchy class #3789

Closed
wants to merge 1 commit into from

Conversation

jedateach
Copy link
Contributor

This has been marked as "todo" since forever. I just need it for a project.

naturalNext function doesn't have unit tests, so they both need unit tests at some stage.

Only tested with parent->children relationship so far, rather than deep nesting.

}

// if this is not an instance of the root class or has the root id, search the parent
if(!(is_numeric($root) && $root == $this->owner->ID || $root == $this->owner->class)
Copy link
Contributor

Choose a reason for hiding this comment

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

You need some more brackets here to group the conditions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this enough?

// if this is not an instance of the root class or has the root id, search the parent
if($root != $this->owner->ID && $root != $this->owner->class && ($parent = $this->owner->Parent())) {
    // ....
}

Copy link
Contributor

Choose a reason for hiding this comment

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

&& $parent->exists()

@dhensby
Copy link
Contributor

dhensby commented Jan 13, 2015

I think this needs to go against 3 branch

@dhensby
Copy link
Contributor

dhensby commented Feb 17, 2015

This also needs tests

@dhensby
Copy link
Contributor

dhensby commented Feb 17, 2015

This actually needs to go against master as it's a breaking API change... even though it was never implemented :(

if(!(is_numeric($root) && $root == $this->owner->ID || $root == $this->owner->class)
&& ($parent = $this->owner->Parent())) {

return $parent->naturalPrev( $className, $root, $this->owner );
Copy link
Contributor

Choose a reason for hiding this comment

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

spacing inside parenthesis shouldn't be there

@jedateach jedateach closed this Mar 31, 2016
@dhensby
Copy link
Contributor

dhensby commented Apr 6, 2016

@tractorcow is there any value in someone picking this up? I don't even know why there's a function stub for this

@tractorcow
Copy link
Contributor

We should just remove the stub in 4.x.

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.

None yet

4 participants