You are here

RegistrationStateController.php in Entity Registration 8.2

Same filename and directory in other branches
  1. 8 src/RegistrationStateController.php

The controller class used for registration state entities

File

src/RegistrationStateController.php
View source
<?php

namespace Drupal\registration;


/**
 * @file
 * The controller class used for registration state entities
 */
class RegistrationStateController extends EntityAPIControllerExportable {
  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();
    }
  }

}

Classes

Namesort descending Description
RegistrationStateController @file The controller class used for registration state entities