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

Shallow augmentation not working for nested relations #2801

Closed
goellner opened this issue Nov 4, 2020 · 1 comment
Closed

Shallow augmentation not working for nested relations #2801

goellner opened this issue Nov 4, 2020 · 1 comment
Assignees

Comments

@goellner
Copy link
Contributor

goellner commented Nov 4, 2020

Bug Description

If you have extended shallowAugmentedArrayKeys like the following snippet, the augmentation does not work on the "link_internal_related" field, which is a replicator with an entry field in it. "link_internal_related" returns the full dataset of the entry and not only the keys specified in shallowAugmentedArrayKeys;

class CustomEntry extends Entry
{
    protected function shallowAugmentedArrayKeys()
    {
        return [
            'id',
            'title',
            'url',
            'permalink',
            'api_url',
            'link_internal_related',
        ];
    }
}

How to Reproduce

  1. Extend shallowAugmentedArrayKeys with fields, that contain relations.
  2. Open the API url of the entry, to see the data
  3. The link_internal_related data contains all the data of the related entry instead of the keys specified in shallowAugmentedArrayKeys

Extra Detail

Shared with Jesse in Discord

Environment

Statamic version: 3.0.0 and up I guess
Tested with 3.0.2, 3.0.6 and 3.0.23

@goellner
Copy link
Contributor Author

goellner commented Nov 5, 2020

I have forked the starter kit and recreated the bug: https://github.com/goellner/starter-kit-cool-writings

I tried to have meaningful commits, so you can see every step that leads to this bug.

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

No branches or pull requests

2 participants