public function WorkflowTransition::getEntity in Workflow 7.2
Same name and namespace in other branches
- 7 includes/Entity/WorkflowTransition.php \WorkflowTransition::getEntity()
Get the Transitions $entity.
Return value
object The entity, that is added to the Transition.
3 calls to WorkflowTransition::getEntity()
- WorkflowScheduledTransition::save in includes/
Entity/ WorkflowScheduledTransition.php - Save a scheduled transition. If the transition is executed, save in history.
- WorkflowTransition::execute in includes/
Entity/ WorkflowTransition.php - Execute a transition (change state of a node).
- WorkflowTransition::post_execute in includes/
Entity/ WorkflowTransition.php - Invokes 'transition post'.
File
- includes/
Entity/ WorkflowTransition.php, line 533 - Contains workflow\includes\Entity\WorkflowTransition. Contains workflow\includes\Entity\WorkflowTransitionController.
Class
- WorkflowTransition
- Implements an actual Transition.
Code
public function getEntity() {
if (empty($this->entity) && $this->entity_type) {
$entity_type = $this->entity_type;
$entity_id = $this->entity_id;
$entity = entity_load_single($entity_type, $entity_id);
// Set the entity cache.
$this->entity = $entity;
// Make sure the vid of Entity and Transition are equal.
// Especially for Scheduled Transition, that do not have this set, yet,
// or may have an outdated revision ID.
$info = entity_get_info($entity_type);
$revision_key = $info['entity keys']['revision'];
$this->revision_id = isset($entity->{$revision_key}) ? $entity->{$revision_key} : NULL;
}
return $this->entity;
}