public function Registration::save in Entity Registration 8.2
Same name in this branch
- 8.2 lib/registration.entity.inc \Registration::save()
- 8.2 src/Registration.php \Drupal\registration\Registration::save()
Same name and namespace in other branches
- 7.2 lib/registration.entity.inc \Registration::save()
- 7 lib/registration.entity.inc \Registration::save()
Save registration.
See also
entity_save()
File
- lib/
registration.entity.inc, line 190 - 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->type
->value());
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();
}