private function WorkflowTransition::_updateEntity in Workflow 8
Internal function to update the Entity.
1 call to WorkflowTransition::_updateEntity()
- WorkflowTransition::executeAndUpdateEntity in src/
Entity/ WorkflowTransition.php - Executes a transition (change state of an entity), from OUTSIDE the entity.
File
- src/
Entity/ WorkflowTransition.php, line 623
Class
- WorkflowTransition
- Implements an actual, executed, Transition.
Namespace
Drupal\workflow\EntityCode
private function _updateEntity() {
// Update the workflow field of the entity.
$field_name = $this
->getFieldName();
$entity = $this
->getTargetEntity();
// N.B. Align the following functions:
// - WorkflowDefaultWidget::massageFormValues();
// - WorkflowManager::executeTransition().
$entity->{$field_name}->workflow_transition = $this;
$entity->{$field_name}->value = $this
->getToSid();
// Populate the entity changed timestamp when the option is checked.
if ($this
->getWorkflow()
->getSetting('always_update_entity')) {
$entity->changed = $this
->getTimestamp();
}
$entity
->save();
}