public function EntityTestStorageController::baseFieldDefinitions

Defines the base properties of the entity type.

@todo: Define abstract once all entity types have been converted.

Overrides DatabaseStorageController::baseFieldDefinitions

3 calls to EntityTestStorageController::baseFieldDefinitions()
3 methods override EntityTestStorageController::baseFieldDefinitions()

File

drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php, line 33
Definition of Drupal\entity_test\EntityTestStorageController.

Class

EntityTestStorageController
Defines the controller class for the test entity.

Namespace

Drupal\entity_test

Code

public function baseFieldDefinitions() {
  $fields['id'] = array(
    'label' => t('ID'),
    'description' => t('The ID of the test entity.'),
    'type' => 'integer_field',
    'read-only' => TRUE,
  );
  $fields['uuid'] = array(
    'label' => t('UUID'),
    'description' => t('The UUID of the test entity.'),
    'type' => 'string_field',
    'property_constraints' => array(
      'value' => array(
        'Length' => array(
          'max' => 128,
        ),
      ),
    ),
  );
  $fields['langcode'] = array(
    'label' => t('Language code'),
    'description' => t('The language code of the test entity.'),
    'type' => 'language_field',
  );
  $fields['name'] = array(
    'label' => t('Name'),
    'description' => t('The name of the test entity.'),
    'type' => 'string_field',
    'translatable' => TRUE,
    'property_constraints' => array(
      'value' => array(
        'Length' => array(
          'max' => 32,
        ),
      ),
    ),
  );
  $fields['type'] = array(
    'label' => t('Type'),
    'description' => t('The bundle of the test entity.'),
    'type' => 'string_field',
    'required' => TRUE,
  );
  $fields['user_id'] = array(
    'label' => t('User ID'),
    'description' => t('The ID of the associated user.'),
    'type' => 'entity_reference_field',
    'settings' => array(
      'target_type' => 'user',
    ),
    'translatable' => TRUE,
  );
  return $fields;
}