I would like to create a node programatically and one field field_supervisors has an entity reference field for the node type People.
In order to set the correct entity reference information I need to set:
[ ["target_id" => 1], ["target_id" => 2], // etc.. ] How can I get the individual id of the entity reference from the field_supervisors. Do I really need to look up the node People before to get the id like $node->id() or is there a way to return something like this pseudo code:
Field->field_supervisors->allReferencedEntitiyOptions which will return all People that are available ?
Thanks