In Drupal 7 I loaded the node/entity I want with node_load / entity_load and, if necessary, then I took a field with multiple deltas and take the value I wanted with a foreach loop.
In Drupal 8 how can I do the same in a hook?
For example, this loads my first value of a field:
$a_id = $adress->field_a->target_id;
In this case an entity reference field. But there are more target_ids.
So how to take them?
$adress->field_a
should be iterable..soforeach ($address->field_a as $item)
?