You are here

public function Registration::save in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 lib/registration.entity.inc \Registration::save()
  2. 7 lib/registration.entity.inc \Registration::save()

Save registration.

Overrides Entity::save

See also

entity_save()

File

lib/registration.entity.inc, line 169
Entity hooks and callbacks for registrations.

Class

Registration
Main class for Registration entities.

Code

public function save() {

  // Set a default state if not provided.
  $wrapper = entity_metadata_wrapper('registration', $this);
  $state = $wrapper->state
    ->value();
  if (!$state) {
    $default_state = registration_get_default_state($wrapper
      ->getBundle());
    if ($default_state) {
      $this->state = $default_state
        ->identifier();
    }
  }
  $this->updated = REQUEST_TIME;
  if (!$this->registration_id && empty($this->created)) {
    $this->created = REQUEST_TIME;
  }
  return parent::save();
}