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:
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', ], ];