Skip to content

Parent not included with requests #618

Open
@Rasmus-Bertell

Description

@Rasmus-Bertell

I have this package installed alongside spatie/laravel-query-builder but trying to include the parent with the request does nothing. I opened a discussion on the Query Builder side, but it seems like this is a problem in nested set.

It seems like the problem stems from the fix to an earlier issue1. While this fix works it seems to have the unintended consequence of removing parent relationship when requesting it and it has led to confusion and multiple issues23.

I think this fix should be revisited and implemented such that it doesn't interfere with other features.

/**
* @return array
*/
protected function getArrayableRelations()
{
$result = parent::getArrayableRelations();
// To fix #17 when converting tree to json falling to infinite recursion.
unset($result['parent']);
return $result;
}

Footnotes

  1. Maximum function nesting level error #17

  2. The 'parent' relationship missing in Model toJson() #507

  3. ->with('parent') do not work #563

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions