0

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();
$query
  ->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]);
var_dump($node,1);

//dpm(entity_get_info());
$entity  = entity_export('node', $node);
var_dump($entity,1);
0

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? – user1015214 Apr 2 '14 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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