You are here

public function WorkflowConfigTransition::__construct in Workflow 8

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

Overrides ConfigEntityBase::__construct

File

src/Entity/WorkflowConfigTransition.php, line 81

Class

WorkflowConfigTransition
Workflow configuration entity to persistently store configuration.

Namespace

Drupal\workflow\Entity

Code

public function __construct(array $values = [], $entityType = NULL) {

  // Please be aware that $entity_type and $entityType are different things!
  parent::__construct($values, $entity_type = 'workflow_config_transition');
  $state = WorkflowState::load($this->to_sid ? $this->to_sid : $this->from_sid);
  if ($state) {
    $this
      ->setWorkflow($state
      ->getWorkflow());
  }
}