You are here

public function WorkflowTransition::__construct in Workflow 7.2

Same name and namespace in other branches
  1. 7 includes/Entity/WorkflowTransition.php \WorkflowTransition::__construct()

Creates a new entity.

No arguments passed, when loading from DB. All arguments must be passed, when creating an object programmatically. One argument $entity may be passed, only to directly call delete() afterwards.

Parameters

array $values: The initial values.

string $entityType: The entity type of this Entity subclass.

Overrides Entity::__construct

See also

entity_create()

1 call to WorkflowTransition::__construct()
WorkflowScheduledTransition::__construct in includes/Entity/WorkflowScheduledTransition.php
Constructor.
1 method overrides WorkflowTransition::__construct()
WorkflowScheduledTransition::__construct in includes/Entity/WorkflowScheduledTransition.php
Constructor.

File

includes/Entity/WorkflowTransition.php, line 62
Contains workflow\includes\Entity\WorkflowTransition. Contains workflow\includes\Entity\WorkflowTransitionController.

Class

WorkflowTransition
Implements an actual Transition.

Code

public function __construct(array $values = array(), $entityType = 'WorkflowTransition') {

  // Please be aware that $entity_type and $entityType are different things!
  parent::__construct($values, $entityType);
  $this->hid = isset($this->hid) ? $this->hid : 0;

  // This transition is not scheduled
  $this->is_scheduled = FALSE;

  // This transition is not executed, if it has no hid, yet, upon load.
  $this->is_executed = $this->hid > 0;

  // Fill the 'new' fields correctly. @todo D8: rename these fields in db table.
  $this->entity_id = $this->nid;
  $this->new_sid = $this->sid;

  // Initialize wid, if not set.
  if ($this->old_sid && !$this->wid) {
    $this
      ->getWorkflow();
  }
}