You are here

public function Entity::identifier in Entity API 7

Returns the entity identifier, i.e. the entities name or numeric id.

Return value

string|int The identifier of the entity. If the entity type makes use of a name key, the name is returned, else the numeric id.

Overrides EntityInterface::identifier

See also

entity_id()

4 calls to Entity::identifier()
Entity::defaultUri in includes/entity.inc
Override this in order to implement a custom default URI and specify 'entity_class_uri' as 'uri callback' hook_entity_info().
Entity::delete in includes/entity.inc
Permanently deletes the entity.
Entity::getTranslation in includes/entity.inc
Gets the raw, translated value of a property or field.
EntityClass::defaultURI in tests/entity_test.module
Specifies the default uri, which is picked up by uri() by default.

File

includes/entity.inc, line 234
Provides a base class for entities.

Class

Entity
A common class for entities.

Code

public function identifier() {
  return isset($this->{$this->nameKey}) ? $this->{$this->nameKey} : NULL;
}