You are here

public static function MaestroProductionAssignments::baseFieldDefinitions in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Entity/MaestroProductionAssignments.php \Drupal\maestro\Entity\MaestroProductionAssignments::baseFieldDefinitions()

Field properties defined here.

Overrides ContentEntityBase::baseFieldDefinitions

File

src/Entity/MaestroProductionAssignments.php, line 122

Class

MaestroProductionAssignments
Defines the MaestroProductionAssignments entity.

Namespace

Drupal\maestro\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

  // Auto increment queue ID.
  $fields['id'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('id'))
    ->setDescription(t('The ID of the Maestro production assignment entry.'))
    ->setReadOnly(TRUE);
  $fields['queue_id'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Queue ID'))
    ->setDescription(t('The task ID this assignment item belongs to.'))
    ->setSetting('target_type', 'maestro_queue')
    ->setSetting('handler', 'default');
  $fields['assign_type'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Assign Type'))
    ->setDescription(t('The machine name of the assignment. eg. role, user, group, future value.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);
  $fields['by_variable'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Assign By Variable'))
    ->setDescription(t('Set to 0 for fixed. 1 for by variable.'))
    ->setSettings([
    'default_value' => '0',
  ]);

  // TODO: this is assigned by the machine name such as the user name or the role name.
  $fields['assign_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Assign ID'))
    ->setDescription(t('The ID of the entity this is assigned to.'))
    ->setSettings([
    'default_value' => '0',
  ]);
  $fields['process_variable'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Process Variable ID'))
    ->setDescription(t('The process variable used in this assignment.'))
    ->setSetting('target_type', 'maestro_process_variables')
    ->setSetting('handler', 'default');
  $fields['assign_back_id'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Assign Back'))
    ->setDescription(t('Who to re-assign this to if it was reassigned'))
    ->setSettings([
    'default_value' => '0',
  ]);
  $fields['task_completed'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Has this task been completed'))
    ->setDescription(t('Set to 0 for not. 1 for completed.'))
    ->setSettings([
    'default_value' => '0',
  ]);

  // The created, started, changed and completed fields.
  $fields['created'] = BaseFieldDefinition::create('created')
    ->setLabel(t('Created'))
    ->setDescription(t('The time that the queue item was created.'));
  $fields['changed'] = BaseFieldDefinition::create('changed')
    ->setLabel(t('Changed'))
    ->setDescription(t('The time that the queue item entity was last edited.'));
  return $fields;
}