You are here

public static function ReplicationHistoryItem::propertyDefinitions in Replication 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/ReplicationHistoryItem.php \Drupal\replication\Plugin\Field\FieldType\ReplicationHistoryItem::propertyDefinitions()

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/ReplicationHistoryItem.php, line 30

Class

ReplicationHistoryItem
Plugin annotation @FieldType( id = "replication_history", label = @Translation("Replication history"), description = @Translation("History information for a replication."), list_class =…

Namespace

Drupal\replication\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['doc_write_failures'] = DataDefinition::create('integer')
    ->setLabel(t('Write failures'))
    ->setDescription(t('Number of failed document writes'))
    ->setRequired(FALSE);
  $properties['docs_read'] = DataDefinition::create('integer')
    ->setLabel(t('Documents read'))
    ->setDescription(t('Number of documents read.'))
    ->setRequired(FALSE);
  $properties['docs_written'] = DataDefinition::create('integer')
    ->setLabel(t('Documents written'))
    ->setDescription(t('Number of documents written.'))
    ->setRequired(FALSE);
  $properties['start_last_seq'] = DataDefinition::create('string')
    ->setLabel(t('Start sequence'))
    ->setDescription(t('Sequence ID where the replication started.'))
    ->setRequired(FALSE);
  $properties['end_last_seq'] = DataDefinition::create('string')
    ->setLabel(t('End sequence'))
    ->setDescription(t('Sequence ID where the replication ended.'))
    ->setRequired(FALSE);
  $properties['missing_checked'] = DataDefinition::create('integer')
    ->setLabel(t('Missing checked'))
    ->setDescription(t('Number of missing documents checked.'))
    ->setRequired(FALSE);
  $properties['missing_found'] = DataDefinition::create('integer')
    ->setLabel(t('Missing found'))
    ->setDescription(t('Number of missing documents found.'))
    ->setRequired(FALSE);
  $properties['recorded_seq'] = DataDefinition::create('string')
    ->setLabel(t('Recorded sequence'))
    ->setDescription(t('Recorded intermediate sequence.'))
    ->setRequired(FALSE);
  $properties['session_id'] = DataDefinition::create('string')
    ->setLabel(t('Session ID'))
    ->setDescription(t('Unique session ID for the replication.'))
    ->setRequired(TRUE);
  $properties['start_time'] = DataDefinition::create('datetime_iso8601')
    ->setLabel(t('Start time'))
    ->setDescription(t('Date and time when replication started.'))
    ->setRequired(FALSE);
  $properties['end_time'] = DataDefinition::create('datetime_iso8601')
    ->setLabel(t('End time'))
    ->setDescription(t('Date and time when replication ended.'))
    ->setRequired(FALSE);
  $fields['fail_info'] = DataDefinition::create('string_long')
    ->setLabel(t('Replication fail info'))
    ->setDescription(t('When a replication fails, it contains the info about the cause of the fail.'))
    ->setComputed(TRUE)
    ->setRequired(FALSE)
    ->setClass('\\Drupal\\replication\\FailInfo');
  return $properties;
}