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

Handling child entity references in the parent #1041

Open
belambic opened this issue Sep 5, 2018 · 0 comments
Open

Handling child entity references in the parent #1041

belambic opened this issue Sep 5, 2018 · 0 comments

Comments

@belambic
Copy link

belambic commented Sep 5, 2018

I watched the video tutorials by Mateus which were very useful, but the data model he is working with has the entity reference on the parent content type. Unfortunately the data model I'm working with has the entity reference on the child content type, like so:

Parent: Organization has no entity reference fields
Child: Campaign has an entity reference field pointing to the organization

I want my organization resource to include relationships for each campaign associated with that organization. Is there a simple way to do that?

I've tried this, where $this->campaigns returns an array of nids, which didn't work:

// Add campaigns as references. $public_fields['campaigns'] = [ 'callback' => [$this, 'campaigns'], 'resource' => [ 'name' => 'campaign', 'majorVersion' => '1', 'minorVersion' => '0', ], ];

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

1 participant