You are here

public function WorkflowTransition::__construct in Workflow 7

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

Constructor 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.

1 method overrides WorkflowTransition::__construct()
WorkflowScheduledTransition::__construct in includes/Entity/WorkflowScheduledTransition.php
Constructor 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.

File

includes/Entity/WorkflowTransition.php, line 39
Contains workflow\includes\Entity\WorkflowTransition.

Class

WorkflowTransition
Implements an actual Transition.

Code

public function __construct($entity_type = 'node', $entity = NULL, $field_name = '', $old_sid = 0, $new_sid = 0, $uid = 0, $stamp = 0, $comment = '') {
  $this->entity_type = $this->entity_type ? $this->entity_type : $entity_type;
  $this->field_name = !$field_name ? $this->field_name : $field_name;
  $this->language = $this->language ? $this->language : 'und';
  $this->entity = $entity;
  $this->nid = $entity_type == 'node' ? $entity->nid : entity_id($entity_type, $entity);
  $this->old_sid = $old_sid;
  $this->sid = $new_sid;
  $this->uid = $uid;
  $this->stamp = $stamp;
  $this->comment = $comment;

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