'field_name' => 'bf_1',
'entity_type' => $this->entityTypeId,
'type' => 'test_field',
- 'cardinality' => 1
+ 'cardinality' => 1,
]);
$field_storage->save();
$this->fieldStorages[] = $field_storage;
'field_name' => 'bf_2',
'entity_type' => $this->entityTypeId,
'type' => 'test_field',
- 'cardinality' => 4
+ 'cardinality' => 4,
]);
$field_storage->save();
$this->fieldStorages[] = $field_storage;
$bundle = reset($this->bundles);
$field_storage = reset($this->fieldStorages);
$field_name = $field_storage->getName();
- $factory = \Drupal::service('entity.query');
+ $storage = \Drupal::entityTypeManager()->getStorage('entity_test');
// There are 10 entities of this bundle.
- $found = $factory->get('entity_test')
+ $found = $storage
+ ->getQuery()
->condition('type', $bundle)
->execute();
$this->assertEqual(count($found), 10, 'Correct number of entities found before deleting');
$this->assertEqual($field->getTargetBundle(), $bundle, 'The deleted field is for the correct bundle');
// Check that the actual stored content did not change during delete.
- $storage = \Drupal::entityManager()->getStorage($this->entityTypeId);
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = $storage->getTableMapping();
$table = $table_mapping->getDedicatedDataTableName($field_storage);
}
// There are 0 entities of this bundle with non-deleted data.
- $found = $factory->get('entity_test')
+ $found = $storage
+ ->getQuery()
->condition('type', $bundle)
->condition("$field_name.deleted", 0)
->execute();
// There are 10 entities of this bundle when deleted fields are allowed, and
// their values are correct.
- $found = $factory->get('entity_test')
+ $found = $storage
+ ->getQuery()
->condition('type', $bundle)
->condition("$field_name.deleted", 1)
->sort('id')
'field_name' => $field_name,
'entity_type' => $this->entityTypeId,
'type' => 'test_field',
- 'cardinality' => 1
+ 'cardinality' => 1,
]);
$deleted_field_storage->save();
// Create the field.
'field_name' => $field_name,
'entity_type' => $this->entityTypeId,
'type' => 'test_field',
- 'cardinality' => 1
+ 'cardinality' => 1,
]);
$field_storage->save();
FieldConfig::create([