I am trying to use entity export to move existing entitys from a live to dev site. I tried the code below and it returned

NULL int(1)
However, when I did a dump of the $node object, it did dump the object correctly, so I know that the entity exists

$query = new EntityFieldQuery();
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'events')
  ->propertyCondition('status', 1)
  ->propertyOrderBy('created', 'DESC');
$result = $query->execute();  

$nids = array_keys($result['node']);
//var_dump($nids, 1);
$node = node_load($nids[0]);

$entity  = entity_export('node', $node);

1 Answer 1


The entity_export function comes with the following caveat:

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

This means that if your entity type does not come with this, a call to entity_export() will return NULL.

This seems to be the case with node.

I am not sure, but I think the core team never got around to adding CRUD API to core entities.

If you inspect a node entity with dpm(), there is nothing. If you do:

 debug($node->delete, 'node->delete');

it prints NULL.

  • I assumed that node would, as it comes with drupal core. Is this not the case? If not, is there a different way of exporting it? Apr 2, 2014 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.