Commit 728e4f78 authored by catch's avatar catch
Browse files

Issue #2917606 by init90, julia_schwarz, thomas.pischke.newscycle, amateescu:...

Issue #2917606 by init90, julia_schwarz, thomas.pischke.newscycle, amateescu: FieldStorageConfigStorage::loadByProperties() with passed 'entity_type' and 'field_name' as conditions doesn't return any result
parent 184bd59c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public function loadByProperties(array $conditions = []) {
    if (empty($conditions['deleted'])) {
      if (isset($conditions['entity_type']) && isset($conditions['field_name'])) {
        // Optimize for the most frequent case where we do have a specific ID.
        $id = $conditions['entity_type'] . $conditions['field_name'];
        $id = $conditions['entity_type'] . '.' . $conditions['field_name'];
        $storages = $this->loadMultiple([$id]);
      }
      else {
+5 −1
Original line number Diff line number Diff line
@@ -219,7 +219,11 @@ public function testRead() {
    $this->assertArrayHasKey($id, $fields, 'The field has the correct key.');

    // Check that 'multi column' criteria works.
    $fields = $field_storage_config_storage->loadByProperties(['field_name' => $field_storage_definition['field_name'], 'type' => $field_storage_definition['type']]);
    $fields = $field_storage_config_storage->loadByProperties([
      'field_name' => $field_storage_definition['field_name'],
      'type' => $field_storage_definition['type'],
      'entity_type' => $field_storage_definition['entity_type'],
    ]);
    $this->assertCount(1, $fields, 'The field was properly read.');
    $this->assertArrayHasKey($id, $fields, 'The field has the correct key.');
    $fields = $field_storage_config_storage->loadByProperties(['field_name' => $field_storage_definition['field_name'], 'type' => 'foo']);