function EntityTypeRepositoryInterface::getEntityTypeFromClass
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeFromClass()
- 10 core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeFromClass()
- 11.x core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php \Drupal\Core\Entity\EntityTypeRepositoryInterface::getEntityTypeFromClass()
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()
2 methods override EntityTypeRepositoryInterface::getEntityTypeFromClass()
- EntityManager::getEntityTypeFromClass in core/
lib/ Drupal/ Core/ Entity/ EntityManager.php - EntityTypeRepository::getEntityTypeFromClass in core/
lib/ Drupal/ Core/ Entity/ EntityTypeRepository.php - Gets the entity type ID based on the class that is called on.
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\EntityCode
public function getEntityTypeFromClass($class_name);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.