You are here

function entity_import in Entity API 7

Imports an entity.

Note: Currently, this only works for entity types provided with the entity CRUD API.

Parameters

$entity_type: The type of the entity.

string $export: The string containing the serialized entity as produced by entity_export().

Return value

object The imported entity object not yet saved.

2 calls to entity_import()
EntityAPITestCase::testExportables in ./entity.test
Test loading entities defined in code.
EntityDefaultUIController::operationFormValidate in includes/entity.ui.inc
Operation form validation callback.

File

./entity.module, line 522

Code

function entity_import($entity_type, $export) {
  $info = entity_get_info($entity_type);
  if (in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
    return entity_get_controller($entity_type)
      ->import($export);
  }
}