<?php

/**
 * @file
 * Implement UUID/Entity hooks for integrating with deploy and other modules.
 */

/**
 * Implements hook_entity_info_alter().
 */
function bean_uuid_entity_info_alter(&$entity_info) {
  // Set the properties bellow for bean entity so UUIDs get created on sync.
  $entity_info['bean']['uuid'] = TRUE;
  $entity_info['bean']['entity keys']['uuid'] = 'uuid';
}

/**
 * Implements hook_entity_uuid_load().
 */
function bean_uuid_entity_uuid_load(&$entities, $entity_type) {
  if ($entity_type == 'bean') {
    entity_property_id_to_uuid($entities, 'bean', 'bid');
  }
}

/**
 * Implements hook_entity_uuid_presave().
 */
function bean_uuid_entity_uuid_presave(&$entity, $entity_type) {
  if ($entity_type == 'bean') {
    entity_property_uuid_to_id($entity, 'bean', 'bid');
  }
}
