Comments

mglaman’s picture

Status: Active » Needs review
StatusFileSize
new30.11 KB

Patch attached. I have a feeling this and #2377115: Replace all instances of entity_load('field_config') and entity_load_multiple('field_config') with static method calls might cause conflicts due to modifications of "use" declarations.

dstotijn’s picture

Status: Needs review » Reviewed & tested by the community

Applied patch, grepped for occurrences of "entity_load('field_storage_config'" and "entity_load_multiple('field_storage_config')"; none found. Reviewed the replacements with static method calls. Looks fine to me.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new30.09 KB

Rerolled to fix conflicts.

mglaman’s picture

Issue tags: -Needs reroll

Forgot to remove tag, hide old patch.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Some minor comments. Feel free to correct those but marking RTBC anyway, because those are minor enough that they could be ignored IMO.

  1. +++ b/core/modules/comment/src/Tests/CommentNodeChangesTest.php
    @@ -10,6 +10,8 @@
     use Drupal\field\Entity\FieldConfig;
     
    +use Drupal\field\Entity\FieldStorageConfig;
    
    +++ b/core/modules/field/src/Tests/FieldImportCreateTest.php
    @@ -9,6 +9,8 @@
     use Drupal\field\Entity\FieldConfig;
     
    +use Drupal\field\Entity\FieldStorageConfig;
    

    No biggie, but this empty line between the use statements should be removed.

  2. +++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
    @@ -9,6 +9,7 @@
    +use Drupal\field\Entity\FieldStorageConfig;
    
    +++ b/core/modules/field/src/Tests/TranslationWebTest.php
    @@ -8,6 +8,7 @@
    +use Drupal\field\Entity\FieldStorageConfig;
     use Drupal\field\Entity\FieldConfig;
    
    +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
    @@ -10,6 +10,7 @@
    +use Drupal\field\Entity\FieldStorageConfig;
     use Drupal\field\Entity\FieldConfig;
    
    +++ b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php
    @@ -8,6 +8,7 @@
    +use Drupal\field\Entity\FieldStorageConfig;
     use Drupal\field\Entity\FieldConfig;
    

    Super minor, but if this to attain alphabetical ordering FieldStorageConfig should come after FieldConfig

  3. +++ b/core/modules/field/src/Tests/FieldImportDeleteTest.php
    @@ -56,8 +57,8 @@ public function testImportDelete() {
    -    $field_storage_uuid = entity_load('field_storage_config', $field_storage_id)->uuid();
    -    $field_storage_uuid_2 = entity_load('field_storage_config', $field_storage_id_2)->uuid();
    +    $field_storage_uuid = FieldStorageConfig::load($field_storage_id)->uuid();
    +    $field_storage_uuid_2 = FieldStorageConfig::load($field_storage_id_2)->uuid();
    
    @@ -75,9 +76,11 @@ public function testImportDelete() {
    -    $field_storage = entity_load('field_storage_config', $field_storage_id, TRUE);
    +    \Drupal::entityManager()->getStorage('field_storage_config')->resetCache(array($field_storage_id));
    +    $field_storage = FieldStorageConfig::load($field_storage_id);
    ...
    -    $field_storage_2 = entity_load('field_storage_config', $field_storage_id_2, TRUE);
    +    \Drupal::entityManager()->getStorage('field_storage_config')->resetCache(array($field_storage_id_2));
    +    $field_storage_2 = FieldStorageConfig::load($field_storage_id_2);
    

    Since we have to get the storage here anyway, this code could be made a bit nicer by avoiding the reliance on the static functions.

    E.g. put a

    $storage = $this->container->get('entity.manager')->getStorage('field_storage_config');
    

    at the top of the function ($this->container is preferred over \Drupal in tests)

    and then just use

    $storage->load($id)
    

    and

    $storage->resetCache([$id]);
    

    below.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: replace_all_instances-2377117-4.patch, failed testing.

mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new30.15 KB
new1.53 KB

Rerolled with suggestions from points 1 and 2. I think point 3 is valid, however it isn't universal (see resets done on field_config, other tests.)

Status: Needs review » Needs work

The last submitted patch, 8: replace_all_instances-2377117-8.patch, failed testing.

swentel’s picture

Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new30.2 KB
pcambra’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies cleanly and conversions look fine.

berdir’s picture

Component: entity system » field system

Moving to the right component :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 2377117-12.patch, failed testing.

Status: Needs work » Needs review

pcambra queued 12: 2377117-12.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 12: 2377117-12.patch, failed testing.

rpayanm’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new30.2 KB

rerolled

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Needs a reroll.

pcambra’s picture

Status: Needs work » Needs review
StatusFileSize
new30.26 KB
swentel’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4d8bd96 and pushed to 8.0.x. Thanks!

beta evaluation is in the meta.

  • alexpott committed 4d8bd96 on 8.0.x
    Issue #2377117 by mglaman, rpayanm, pcambra: Replace all instances of...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.