You are here

public function RegistrationStateController::save in Entity Registration 7

Same name and namespace in other branches
  1. 8.2 lib/registration_state.controller.inc \RegistrationStateController::save()
  2. 7.2 lib/registration_state.controller.inc \RegistrationStateController::save()

Overridden to care exportables that are overridden.

Overrides EntityAPIControllerExportable::save

File

lib/registration_state.controller.inc, line 9
The controller class used for registration state entities

Class

RegistrationStateController
@file The controller class used for registration state entities

Code

public function save($entity, DatabaseTransaction $transaction = NULL) {
  parent::save($entity, $transaction);
  if ($entity->default_state == 1) {
    $query = db_update('registration_state')
      ->fields(array(
      'default_state' => 0,
    ))
      ->condition('registration_state_id', $entity->registration_state_id, '<>');
    $query
      ->execute();
  }
}