You are here

function comment_entity_uuid_presave in Universally Unique IDentifier 7

Implements hook_entity_uuid_presave().

Related topics

File

./uuid.core.inc, line 141
Implementation of UUID hooks for all core modules.

Code

function comment_entity_uuid_presave(&$entity, $entity_type) {
  switch ($entity_type) {
    case 'node':
      entity_property_uuid_to_id($entity, 'user', 'last_comment_uid');
      break;
    case 'comment':

      // entity_make_entity_local() may have unset cid, add back if necessary.
      if (!isset($entity->cid)) {
        $entity->cid = NULL;
      }
      entity_property_uuid_to_id($entity, 'user', array(
        'uid',
        'u_uid',
      ));
      entity_property_uuid_to_id($entity, 'node', 'nid');
      break;
  }
}