You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The current implementation of the isDescendantOf and isAncestorOf methods of the LdapRecord\Models\Model class are non-recursive. While the documentation indeed indicates this as the intended behavior, such usage is not intuitive with respect to the usual unbounded meaning of the terms descendant and ancestor.
Describe the solution you'd like
In order not to break existing code, I would like to initially suggest adding an optional second boolean parameter to the aforementioned methods representing whether the comparison should be recursive or not, which would default to the current non-recursive behavior, e.g. $recursive = false.
Describe alternatives considered
One alternative would be to change the behavior of isDescendantOf and isAncestorOf to be always recursive, while adding something like isChildOf and isParentOf for the non-recursive counterparts. This could be combined with the above initial suggestion and be phased in over time, perhaps with deprecation notices, as not to catch users by surprise.
Hi @kkatpcc, thanks! Appreciate the creation of the issue.
I'm going to consider this a bug so I'm going to modify the behaviour of isDescendantOf and isAncestorOf so they work properly and return the expected result.
I'm also going to add your suggested methods isChildOf and isParentOf that preserves the current behaviour.
Is your feature request related to a problem? Please describe.
The current implementation of the
isDescendantOf
andisAncestorOf
methods of theLdapRecord\Models\Model
class are non-recursive. While the documentation indeed indicates this as the intended behavior, such usage is not intuitive with respect to the usual unbounded meaning of the terms descendant and ancestor.Describe the solution you'd like
In order not to break existing code, I would like to initially suggest adding an optional second boolean parameter to the aforementioned methods representing whether the comparison should be recursive or not, which would default to the current non-recursive behavior, e.g.
$recursive = false
.Describe alternatives considered
One alternative would be to change the behavior of
isDescendantOf
andisAncestorOf
to be always recursive, while adding something likeisChildOf
andisParentOf
for the non-recursive counterparts. This could be combined with the above initial suggestion and be phased in over time, perhaps with deprecation notices, as not to catch users by surprise.Additional context
Related commit comment: f2a4a3a#commitcomment-38808641
The text was updated successfully, but these errors were encountered: