protected function getEntityById($entity_id) {
    $entity_ids = $this->entityTypeManager->getStorage('media_type')
      ->getQuery()->condition('id', $entity_id)->execute();

    $id = reset($entity_ids);
    if ($id !== FALSE) {
      return $this->entityTypeManager->getStorage('media_type')->load($id);
    }
    return '';
  }
protected function getEntityById($entity_id) {
    $entity_ids = $this->entityTypeManager->getStorage('media_type')
      ->getQuery()->condition('id', $entity_id)->execute();

    $id = reset($entity_ids);
    if ($id !== FALSE) {
      return $this->entityTypeManager->getStorage('media_type')->load($id);
    }
    return '';
  }
protected function getEntityById ( $ entity_id ) { $ entity_ids = $ this -> entityTypeManager -> getStorage ( 'media_type' ) -> getQuery ( ) -> condition ( 'id' , $ entity_id ) -> execute ( ) ; $ id = reset ( $ entity_ids ) ; if ( $ id !== FALSE ) { return $ this -> entityTypeManager -> getStorage ( 'media_type' ) -> load ( $ id ) ; } return '' ; }
Find a media_type by id and return it or nothing.

@param string $entity_id
The media type.

@return \Drupal\Core\Entity\EntityInterface|string
Return the loaded entity or nothing.

@throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
Thrown by getStorage() if the entity type doesn't exist.
@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Thrown by getStorage() if the storage handler couldn't be loaded.
Find a media_type by id and return it or nothing .