public function EntityType::hasKey

public EntityType::hasKey($key)

Indicates if a given entity key exists.

Parameters

string $key: The name of the entity key to check.

Return value

bool TRUE if a given entity key exists, FALSE otherwise.

Overrides EntityTypeInterface::hasKey

File

core/lib/Drupal/Core/Entity/EntityType.php, line 379

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function hasKey($key) {
  $keys = $this->getKeys();
  return !empty($keys[$key]);
}

© 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!EntityType.php/function/EntityType::hasKey/8.1.x