public function 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\EntityCode
public function getEntityTypeFromClass($class_name);
© 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!EntityTypeRepositoryInterface.php/function/EntityTypeRepositoryInterface::getEntityTypeFromClass/8.1.x