You are here

public function EntityDrupalWrapper::debugIdentifierLocation in Entity API 7

Returns a string to use to identify this wrapper in error messages.

Overrides EntityMetadataWrapper::debugIdentifierLocation

1 call to EntityDrupalWrapper::debugIdentifierLocation()
EntityDrupalWrapper::set in includes/entity.wrapper.inc
Overridden to support setting the entity by either the object or the id.

File

includes/entity.wrapper.inc, line 951
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityDrupalWrapper
Provides a wrapper for entities registrered in hook_entity_info().

Code

public function debugIdentifierLocation() {

  // An entity wrapper can be at the top of the chain or a part of it.
  if (isset($this->info['name'])) {

    // This wrapper is part of a chain, eg in the position node->author.
    // Return the name.
    $debug = $this->info['name'];
  }
  else {

    // This is a wrapper for an actual entity: return its type and id.
    $debug = $this->info['type'] . '(' . $this
      ->getIdentifier() . ')';
  }
  if (isset($this->info['parent'])) {
    $debug = $this->info['parent']
      ->debugIdentifierLocation() . '->' . $debug;
  }
  return $debug;
}