How to get instance of referenced entity? I have a node object with image field named field_image. When I do

$node
  -&gt;get('field_image')
  -&gt;first()
  -&gt;getValue()


I get array with some properties instead of entity object. The array looks like this:

'target_id' =&gt; string '8' (length=1)
'alt' =&gt; string '' (length=0)
'title' =&gt; string '' (length=0)
'width' =&gt; string '587' (length=3)
'height' =&gt; string '458' (length=3)
'_loaded' =&gt; boolean true
  '_accessCacheability' =&gt; 
    object(Drupal\Core\Cache\CacheableMetadata)[1092]
      protected 'cacheContexts' =&gt; 
        array (size=0)
          ...
      protected 'cacheTags' =&gt; 
        array (size=0)
          ...
      protected 'cacheMaxAge' =&gt; int -1


Do I have to manullay load the file entity using target_id or there is a way to automatically get referenced entity object from instance of Drupal\image\Plugin\Field\FieldType\ImageItem?

Why the referenced entity is not accessible via getter? It could be lazy loaded if it's not available immediately.
The path to referenced entity is very long:
// $id = some node ID
// $field = field name for entity reference field
$node = Node::load($id);

/** @var \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $referenceItem */
$referenceItem = $node-&gt;get($field)-&gt;first();

/** @var \Drupal\Core\Entity\Plugin\DataType\EntityReference $entityReference */
$entityReference = $referenceItem-&gt;get('entity');

/** @var \Drupal\Core\Entity\Plugin\DataType\EntityAdapter $entityAdapter */
$entityAdapter = $entityReference-&gt;getTarget();

/** @var \Drupal\Core\Entity\EntityInterface $referencedEntity */
$referencedEntity = $entityAdapter-&gt;getValue();

// At this point $referencedEntity is the referenced entity object.

Of course one can still get it via one liner call, but still, it is cumbersome and I wonder why EntityReferenceItem does not provide method that would return the reference entity object.
$referencedEntity = $node
  -&gt;get($field)
  -&gt;first()
  -&gt;get('entity')
  -&gt;getTarget()
  -&gt;getValue()
;

Note: if you have php 8, you can use the nullsafe operator:
$referencedEntity = $node
  ?-&gt;get($field)
  ?-&gt;first()
  ?-&gt;get('entity')
  ?-&gt;getTarget()
  ?-&gt;getValue()
;

It's also worth noting that it's quite easy to get array of all referenced entities:
$node-&gt;get($field)-&gt;referencedEntities();

It works because for entity reference fields $node-&gt;get($field) returns instance of EntityReferenceFieldItemList which implements referencedEntities() method.