2

I have a data structure where content type research has an entity reference field scientists.

The content type scientists does not have any research reference entity field though.

I can get all scientists that a particular research has through research.

But is there a way to get all researches one particular scientist has? When content types were created I wasn't involved, so I'm trying to see my options whether I can somehow click a checkbox to make this applicable.

When I tried to set up a field with type of entity reference and pointed it to research for scientists, they were empty.

Any help is highly appreciated.

3
3

Is there a way to get all researches one particular scientist has?

Yes, search for the scientist target id:

$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
  'type' => 'research',
  'field_scientists' => $scientist_id,
]);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.