You are here

function eck_update_7007 in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 eck.install \eck_update_7007()

Update 7007.

File

./eck.install, line 465
ECK's requirements, schemas, and logic for install and uninstall.

Code

function eck_update_7007() {

  // Lets generate the machine names for each bundle.
  $results = db_select('eck_bundle', 't')
    ->fields('t')
    ->execute();
  foreach ($results as $record) {
    $name = $record->name;
    $entity_type = $record->entity_type;
    $record->machine_name = "{$entity_type}_{$name}";
    db_update('eck_bundle')
      ->fields(array(
      'machine_name' => $record->machine_name,
    ))
      ->condition('id', $record->id, '=')
      ->execute();
  }
}