public static function Message::baseFieldDefinitions

File

src/Entity/Message.php, line 36

Class

Message
Entity class for the tmgmt_message entity.

Namespace

Drupal\tmgmt\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields['mid'] = BaseFieldDefinition::create('integer')
    ->setLabel('Message ID')
    ->setReadOnly(TRUE);
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The node UUID.'))
    ->setReadOnly(TRUE);
  $fields['tjid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Job reference'))
    ->setSetting('target_type', 'tmgmt_job');
  $fields['tjiid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Job item reference'))
    ->setSetting('target_type', 'tmgmt_job_item');
  $fields['type'] = BaseFieldDefinition::create('string')
    ->setLabel('Message type')
    ->setDefaultValue('status');
  $fields['uid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Actor'))
    ->setDescription(t('The user who performed the action.'))
    ->setSettings(array(
    'target_type' => 'user',
  ))
    ->setDefaultValue(0);
  $fields['message'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Message'));
  $fields['variables'] = BaseFieldDefinition::create('map')
    ->setLabel(t('Variables'));
  $fields['created'] = BaseFieldDefinition::create('created')
    ->setLabel('Created time');
  return $fields;
}