You are here

public function Feed::getType in Feeds 8.3

Returns the feed type object that this feed is expected to be used with.

Return value

\Drupal\feeds\FeedTypeInterface The feed type object.

Throws

\Drupal\Core\Entity\EntityStorageException In case the feed type could not be loaded.

Overrides FeedInterface::getType

1 call to Feed::getType()
Feed::preSave in src/Entity/Feed.php
Acts on an entity before the presave hook is invoked.

File

src/Entity/Feed.php, line 189

Class

Feed
Defines the feed entity class.

Namespace

Drupal\feeds\Entity

Code

public function getType() {
  $type = $this
    ->get('type')->entity;
  if (empty($type)) {
    if ($this
      ->id()) {
      throw new EntityStorageException(strtr('The feed type "@type" for feed @id no longer exists.', [
        '@type' => $this
          ->bundle(),
        '@id' => $this
          ->id(),
      ]));
    }
    else {
      throw new EntityStorageException(strtr('The feed type "@type" no longer exists.', [
        '@type' => $this
          ->bundle(),
      ]));
    }
  }
  return $type;
}