EntityTypeRepositoryInterface::getEntityTypeFromClass

public EntityTypeRepositoryInterface::getEntityTypeFromClass($class_name)

Gets the entity type ID based on the class that is called on.

Compares the class this is called on against the known entity classes and returns the entity type ID of a direct match or a subclass as fallback, to support entity type definitions that were altered.

Parameters

string $class_name: Class name to use for searching the entity type ID.

Return value

string The entity type ID.

Throws

\Drupal\Core\Entity\Exception\AmbiguousEntityClassException Thrown when multiple subclasses correspond to the called class.

\Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException Thrown when no entity class corresponds to the called class.

See also

\Drupal\Core\Entity\Entity::load()

\Drupal\Core\Entity\Entity::loadMultiple()

File

core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php, line 43

Class

EntityTypeRepositoryInterface
Provides an interface for helper methods for loading entity types.

Namespace

Drupal\Core\Entity

Code

public function getEntityTypeFromClass($class_name);
doc_Drupal
2016-10-29 09:08:42
Comments
Leave a Comment

Please login to continue.