diff --git a/core/includes/form.inc b/core/includes/form.inc index aaa8408e4e628a9e9146e8d73ca6482c2d8f567a..c98e9e83f0bae8f5848b63a4dc17f24d0d153756 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -592,7 +592,8 @@ function template_preprocess_form_element_label(&$variables) { * // 1 (or no value explicitly set) means the operation is finished * // and the batch processing can continue to the next operation. * - * $nodes = entity_load_multiple_by_properties('node', array('uid' => $uid, 'type' => $type)); + * $nodes = \Drupal::entityTypeManager()->getStorage('node') + * ->loadByProperties(['uid' => $uid, 'type' => $type]); * $node = reset($nodes); * $context['results'][] = $node->id() . ' : ' . SafeMarkup::checkPlain($node->label()); * $context['message'] = SafeMarkup::checkPlain($node->label()); diff --git a/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php b/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php index aecf8a93e0d65b360ce70006ae446c0d0115007b..36c1ccce0b25189edd7609c4806d7c77c2f65aa2 100644 --- a/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php +++ b/core/modules/node/src/Tests/NodeFormSaveChangedTimeTest.php @@ -52,11 +52,13 @@ protected function setUp() { * Test the changed time after API and FORM save without changes. */ public function testChangedTimeAfterSaveWithoutChanges() { - $node = entity_load('node', 1); + $storage = $this->container->get('entity_type.manager')->getStorage('node'); + $storage->resetCache([1]); + $node = $storage->load(1); $changed_timestamp = $node->getChangedTime(); - $node->save(); - $node = entity_load('node', 1, TRUE); + $storage->resetCache([1]); + $node = $storage->load(1); $this->assertEqual($changed_timestamp, $node->getChangedTime(), "The entity's changed time wasn't updated after API save without changes."); // Ensure different save timestamps. @@ -65,7 +67,8 @@ public function testChangedTimeAfterSaveWithoutChanges() { // Save the node on the regular node edit form. $this->drupalPostForm('node/1/edit', array(), t('Save')); - $node = entity_load('node', 1, TRUE); + $storage->resetCache([1]); + $node = $storage->load(1); $this->assertNotEqual($changed_timestamp, $node->getChangedTime(), "The entity's changed time was updated after form save without changes."); } diff --git a/core/modules/node/src/Tests/NodeLoadMultipleTest.php b/core/modules/node/src/Tests/NodeLoadMultipleTest.php index 31a30eea8cc9fa71e02d83246cb4b9a245f99a53..4add3bd1ee033fc2666c59ac97edc257839f1f94 100644 --- a/core/modules/node/src/Tests/NodeLoadMultipleTest.php +++ b/core/modules/node/src/Tests/NodeLoadMultipleTest.php @@ -39,9 +39,9 @@ function testNodeMultipleLoad() { $this->assertText($node2->label(), 'Node title appears on the default listing.'); $this->assertNoText($node3->label(), 'Node title does not appear in the default listing.'); $this->assertNoText($node4->label(), 'Node title does not appear in the default listing.'); - // Load nodes with only a condition. Nodes 3 and 4 will be loaded. - $nodes = entity_load_multiple_by_properties('node', array('promote' => 0)); + $nodes = $this->container->get('entity_type.manager')->getStorage('node') + ->loadByProperties(array('promote' => 0)); $this->assertEqual($node3->label(), $nodes[$node3->id()]->label(), 'Node was loaded.'); $this->assertEqual($node4->label(), $nodes[$node4->id()]->label(), 'Node was loaded.'); $count = count($nodes);