W3cubDocs

/Drupal 8

public function SqlContentEntityStorage::setEntityType

public SqlContentEntityStorage::setEntityType(EntityTypeInterface $entity_type)

Updates the wrapped entity type definition.

@internal Only to be used internally by Entity API. Expected to be removed by https://www.drupal.org/node/2274017.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The update entity type.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 259

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

public function setEntityType(EntityTypeInterface $entity_type) {
  if ($this->entityType->id() == $entity_type->id()) {
    $this->entityType = $entity_type;
    $this->initTableLayout();
  }
  else {
    throw new EntityStorageException("Unsupported entity type {$entity_type->id()}");
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorage.php/function/SqlContentEntityStorage::setEntityType/8.1.x