statamic-fetch icon indicating copy to clipboard operation
statamic-fetch copied to clipboard

Nested Entries are not fetched.

Open christoffertyrefors opened this issue 5 years ago • 1 comments

I have categories, and each category has a Parent Category. Currently, this is the response i get (I've removed data that doesnt matter for this issue):

{
    data: {
        title: "Sub 2",
        parent_category: {
            title: "Sub 1",
            parent_category: "73b28d21-4243-47cb-99ff-d3bf757cad80",
        }
    }
}

I.e, it fetches the first Parent but the nested ones are not fetched.

If I change line 470 in Fetch.php from return Content::find($value)->toArray(); to return $this->goDeep(Content::find($value)->toArray()); I get the correct results. I don't fully understand the code though, so this might just be a bad idea.

What do you think? If this is OK I will happily submit a PR.

christoffertyrefors avatar May 30 '19 12:05 christoffertyrefors

Hi @christoffertyrefors! Sounds like this could potentially be a bug... Thanks for reporting and offering to submit a PR.

However, since this Addon has suffered a few unplanned breaking changes in the past due to a lack of test-coverage, and since Statamic 3 is (somewhat) around the corner, I'm afraid support and PRs are currently on hold.

I recommend you either create a fork of this repo, or simply keep a local copy with your fix for the time being.

Thanks again!

aryehraber avatar Jun 04 '19 10:06 aryehraber