CommentFileSizeAuthor
#58 replace_all_instances-2322509-58.patch100.9 KBcilefen
#53 replace_all_instances-2322509-53.patch100.76 KBgaurav.goyal
#50 replace_all_instances-2322509-50.patch100.85 KBcilefen
#50 interdiff-48-50.txt680 bytescilefen
#48 replace_all_instances-2322509-48.patch100.37 KBcilefen
#47 replace_all_instances-2322509-47.patch100.77 KBrosinegrean
#47 interdiff-45-47.txt43.57 KBrosinegrean
#45 replace_all_instances-2322509-45.patch103.53 KBrosinegrean
#45 interdiff-43-45.txt3.05 KBrosinegrean
#43 replace_all_instances-2322509-43.patch103.47 KBrosinegrean
#41 interdiff-39-41.txt5.25 KBrosinegrean
#41 replace_all_instances-2322509-41.patch103.47 KBrosinegrean
#39 interdiff-37-39.txt1.72 KBrosinegrean
#39 replace_all_instances-2322509-39.patch103.72 KBrosinegrean
#37 replace_all_instances-2322509-37.patch103.7 KBrosinegrean
#37 interdiff-33-37.txt1.16 KBrosinegrean
#33 interdiff-27-33.txt9.82 KBrosinegrean
#33 replace_all_instances-2322509-33.patch103.98 KBrosinegrean
#27 replace_all_instances-2322509-27.patch99.33 KBcilefen
#27 interdiff-22-27.txt4.54 KBcilefen
#23 drupal8-entity_system-node-load-2322509-22.patch96.36 KBrosinegrean
#21 drupal8-entity_system-node-load-2322509-20.patch96.58 KBjsobiecki
#14 drupal8-entity_system-node-load-2322509-14.patch97.74 KBrosinegrean
#14 interdiff.txt1.46 KBrosinegrean
#12 drupal8-entity_system-node-load-2322509-12.patch96.56 KBrosinegrean
#10 drupal8-entity_system-node-load-2322509-10.patch96.56 KBrosinegrean
#8 drupal8-entity_system-node-load-2322509-8.patch97.2 KBrosinegrean
#7 drupal8-entity_system-node-load-2322509-7.patch.txt99.33 KBrosinegrean
#5 drupal8-entity_system-node-load-2322509-4.patch97.36 KBrosinegrean
#1 drupal8-entity_system-node-load-2322509-1.patch99.06 KBTemoor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Temoor’s picture

Status: Active » Needs review
FileSize
99.06 KB

Status: Needs review » Needs work

The last submitted patch, 1: drupal8-entity_system-node-load-2322509-1.patch, failed testing.

rosinegrean’s picture

Issue tags: -

I will recreate the patch.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
97.36 KB

Patch recreated.

Status: Needs review » Needs work

The last submitted patch, 5: drupal8-entity_system-node-load-2322509-4.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
99.33 KB

Fixed the test that failed.

rosinegrean’s picture

Fixed the file extension.

cilefen’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
rosinegrean’s picture

Status: Needs work » Needs review
FileSize
96.56 KB

Rerolled

Status: Needs review » Needs work

The last submitted patch, 10: drupal8-entity_system-node-load-2322509-10.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
96.56 KB

Rerolled

cilefen’s picture

Status: Needs review » Needs work


core//modules/file/src/Tests/FileListingTest.php: $node = entity_load('node', $node->id());
core//modules/quickedit/src/Tests/QuickEditLoadingTest.php: $node = entity_load('node', 1);

There are two that were missed.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
1.46 KB
97.74 KB
realityloop’s picture

Issue tags: -Needs reroll +Amsterdam2014, +Needs Review
rosinegrean’s picture

Assigned: Temoor » rosinegrean
jsobiecki’s picture

I'm working on review of this issue.

arejo’s picture

Reviewing.

jsobiecki’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Patch looks ok for me (from static perspective). Changeset is huge (because it's major refactorization), but it's also very straightforwards (it's only replacement of node_load into Node::load, and in test cases, call to container of node entities in order to flush cache). Unfortunately, patch doesn't apply on latest version of Drupal, so it's require re-roll. I'm working on this.

jsobiecki’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

I updated patch, now it should apply cleanly. (Ops, missing attachment).

jsobiecki’s picture

Status: Needs review » Needs work

The last submitted patch, 21: drupal8-entity_system-node-load-2322509-20.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
96.36 KB

Fixed the fatal error in the previous patch.

realityloop’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Novice, -Needs Review

I can't see any issues with the code in this patch and tests are passing.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
    @@ -132,7 +133,7 @@ public function build() {
    +          $book_node = Node::load($book['nid']);
    

    Need to inject the node storage here.

  2. +++ b/core/modules/comment/src/Controller/CommentController.php
    @@ -285,7 +286,7 @@ public function renderNewCommentsNodeLinks(Request $request) {
    -      $node = node_load($nid);
    +      $node = Node::load($nid);
    

    Should inject the node storage

  3. +++ b/core/modules/node/src/NodeViewBuilder.php
    @@ -108,7 +109,7 @@ public static function renderLinks(array $element, array $context) {
    -      $entity = entity_load('node', $context['node_entity_id'])->getTranslation($context['langcode']);
    +      $entity = Node::load($context['node_entity_id'])->getTranslation($context['langcode']);
    

    Should inject the node storage.

  4. +++ b/core/modules/node/src/Plugin/views/argument/Nid.php
    @@ -23,7 +24,7 @@ class Nid extends Numeric {
    -    $nodes = node_load_multiple($this->value);
    +    $nodes = Node::loadMultiple($this->value);
    

    Should inject the node storage

  5. +++ b/core/modules/node/src/Plugin/views/argument/Vid.php
    @@ -63,7 +64,7 @@ public function titleQuery() {
    -    $nodes = node_load_multiple(array_unique($nids));
    +    $nodes = Node::loadMultiple(array_unique($nids));
    

    Should inject thr node storage.

  6. +++ b/core/modules/node/src/Plugin/views/row/Rss.php
    @@ -80,7 +81,7 @@ public function preRender($values) {
    -      $this->nodes = node_load_multiple($nids);
    +      $this->nodes = Node::loadMultiple($nids);
    

    Should inject the node storage

cilefen’s picture

Thanks for the review @alexpott. I am working on #25.

cilefen’s picture

Status: Needs work » Needs review
FileSize
4.54 KB
99.33 KB

This patch is for comments 1 and 2 from #25.

3, 4, 5, 6 are still undone.

Comment 3 concerns a static function so I am not clear how to inject things properly.

Status: Needs review » Needs work

The last submitted patch, 27: replace_all_instances-2322509-27.patch, failed testing.

skipyT’s picture

@alexpott: currently we have a big issue here. the commentController has some methods whose are strictly related to nodes. But the comments can be used on any entity. if we inject the node storage and we don't have the nodes activated we are getting these 4 tests failing.

the ideal solution would be to create a new service with the methods whose need the node storage injected. but I don't know if this is possible after the beta release.

cilefen’s picture

@skipyT What if we inject the entity manager and check if the node storage exists?

skipyT’s picture

@cilefen: yes, that would be the simplest solution. but i think it would be a hack. lets see what alexpott will reply.

alexpott’s picture

Let's go with the idea in #30

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
103.98 KB
9.82 KB

Comment 3 from #25 is still undone.

Status: Needs review » Needs work

The last submitted patch, 33: replace_all_instances-2322509-33.patch, failed testing.

The last submitted patch, 33: replace_all_instances-2322509-33.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
1.16 KB
103.7 KB

Fixed the fatal error form #33

Status: Needs review » Needs work

The last submitted patch, 37: replace_all_instances-2322509-37.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
103.72 KB
1.72 KB

Fixed the fatal error from #37
Comment 3 from #25 is still undone.

Status: Needs review » Needs work

The last submitted patch, 39: replace_all_instances-2322509-39.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
103.47 KB
5.25 KB

Fixed the broken tests.

Status: Needs review » Needs work

The last submitted patch, 41: replace_all_instances-2322509-41.patch, failed testing.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
103.47 KB

Rerolled

skipyT’s picture

Status: Needs review » Needs work
+++ b/core/modules/action/src/Tests/BulkFormTest.php
@@ -66,14 +69,14 @@ public function testBulkForm() {
+      $changed_node = Node::load($node->id());

use $node_storage->load instead of Node::load where you already have the node storage.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
3.05 KB
103.53 KB
skipyT’s picture

Status: Needs review » Needs work

@prics: not sure the replace_all_instances-2322509-45.patch is the good file uploaded. The interdiff shows you modified the code, but the patch is the old one.

rosinegrean’s picture

Status: Needs work » Needs review
FileSize
43.57 KB
100.77 KB

@skipyT, good file, did not notice i was changing in BulkFormTest.php from node module. So I replaced Node::load() with $node_storage->load() where we already have the storage.

cilefen’s picture

Status: Needs review » Needs work

The last submitted patch, 48: replace_all_instances-2322509-48.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
FileSize
680 bytes
100.85 KB

rpayanm’s picture

Issue tags: -Amsterdam2014 +Needs reroll
gaurav.goyal’s picture

Issue tags: -Needs reroll
FileSize
100.76 KB

Patch rerolled. Needs reroll tag removed.

rpayanm’s picture

Assigned: rosinegrean » Unassigned
Status: Needs review » Reviewed & tested by the community

Look fine for me :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 53: replace_all_instances-2322509-53.patch, failed testing.

rpayanm’s picture

Issue tags: +Needs reroll
cilefen’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
100.9 KB
rpayanm’s picture

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

Status: Reviewed & tested by the community » Fixed

This change looks super disruptive but actually most of the changes are in tests and the other changes are making classes more honest by injecting the node storage as a dependency. This issue is a prioritized change (deprecated function removal) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. These type of changes will be even better once #2372323: Static loaders on entity types don't return a properly typed object lands. Committed 5c3a1c6 and pushed to 8.0.x. Thanks!

diff --git a/core/modules/file/src/Tests/FileFieldDisplayTest.php b/core/modules/file/src/Tests/FileFieldDisplayTest.php
index 3448f0c..68c1179 100644
--- a/core/modules/file/src/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/src/Tests/FileFieldDisplayTest.php
@@ -8,7 +8,6 @@
 namespace Drupal\file\Tests;
 
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\node\Entity\Node;
 
 /**
  * Tests the display of file fields in node and views.
@@ -57,7 +56,7 @@ function testNodeDisplay() {
     // Check that the default formatter is displaying with the file name.
     $node_storage = $this->container->get('entity.manager')->getStorage('node');
     $node_storage->resetCache(array($nid));
-    $node = Node::load($nid);
+    $node = $node_storage->load($nid);
     $node_file = file_load($node->{$field_name}->target_id);
     $file_link = array(
       '#theme' => 'file_link',

Considering we're getting the node storage here we should just use it instead of the static loader.

  • alexpott committed 5c3a1c6 on 8.0.x
    Issue #2322509 by prics, cilefen, gaurav.goyal, harijari, Temoor:...

Status: Fixed » Closed (fixed)

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