public function Registration::save in Entity Registration 7
Same name and namespace in other branches
- 8.2 lib/registration.entity.inc \Registration::save()
- 7.2 lib/registration.entity.inc \Registration::save()
Save registration.
Overrides Entity::save
See also
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();
}