Commit 58de5374 authored by Dries's avatar Dries

Issue #2024833 by claudiu.cristea: Adopt load() and loadMultiple() on entity storage controllers.

parent d988a30f
...@@ -2550,12 +2550,12 @@ function language_default_locked_languages($weight = 0) { ...@@ -2550,12 +2550,12 @@ function language_default_locked_languages($weight = 0) {
* @param string $langcode * @param string $langcode
* The language code. * The language code.
* *
* @return Drupal\core\Language\Language | FALSE * @return \Drupal\core\Language\Language|null
* A fully-populated language object or FALSE. * A fully-populated language object or NULL.
*/ */
function language_load($langcode) { function language_load($langcode) {
$languages = language_list(Language::STATE_ALL); $languages = language_list(Language::STATE_ALL);
return isset($languages[$langcode]) ? $languages[$langcode] : FALSE; return isset($languages[$langcode]) ? $languages[$langcode] : NULL;
} }
/** /**
......
...@@ -192,17 +192,19 @@ function entity_get_view_modes($entity_type = NULL) { ...@@ -192,17 +192,19 @@ function entity_get_view_modes($entity_type = NULL) {
* Whether to reset the internal cache for the requested entity type. * Whether to reset the internal cache for the requested entity type.
* *
* @return Drupal\Core\Entity\EntityInterface * @return Drupal\Core\Entity\EntityInterface
* The entity object, or FALSE if there is no entity with the given id. * The entity object, or NULL if there is no entity with the given id.
* *
* @see \Drupal\Core\Entity\EntityManager * @see \Drupal\Core\Entity\EntityManager
* @see entity_load_multiple() * @see \Drupal\Core\Entity\EntityStorageControllerInterface
* @see Drupal\Core\Entity\EntityStorageControllerInterface * @see \Drupal\Core\Entity\DatabaseStorageController
* @see Drupal\Core\Entity\DatabaseStorageController * @see \Drupal\Core\Entity\Query\QueryInterface
* @see Drupal\Core\Entity\Query\QueryInterface
*/ */
function entity_load($entity_type, $id, $reset = FALSE) { function entity_load($entity_type, $id, $reset = FALSE) {
$entities = entity_load_multiple($entity_type, array($id), $reset); $controller = Drupal::entityManager()->getStorageController($entity_type);
return isset($entities[$id]) ? $entities[$id] : FALSE; if ($reset) {
$controller->resetCache(array($id));
}
return $controller->load($id);
} }
/** /**
...@@ -218,8 +220,8 @@ function entity_load($entity_type, $id, $reset = FALSE) { ...@@ -218,8 +220,8 @@ function entity_load($entity_type, $id, $reset = FALSE) {
* id. * id.
* *
* @see \Drupal\Core\Entity\EntityManager * @see \Drupal\Core\Entity\EntityManager
* @see Drupal\Core\Entity\EntityStorageControllerInterface * @see \Drupal\Core\Entity\EntityStorageControllerInterface
* @see Drupal\Core\Entity\DatabaseStorageController * @see \Drupal\Core\Entity\DatabaseStorageController
*/ */
function entity_revision_load($entity_type, $revision_id) { function entity_revision_load($entity_type, $revision_id) {
return Drupal::entityManager() return Drupal::entityManager()
...@@ -305,16 +307,16 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { ...@@ -305,16 +307,16 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) {
* An array of entity objects indexed by their ids. * An array of entity objects indexed by their ids.
* *
* @see \Drupal\Core\Entity\EntityManager * @see \Drupal\Core\Entity\EntityManager
* @see Drupal\Core\Entity\EntityStorageControllerInterface * @see \Drupal\Core\Entity\EntityStorageControllerInterface
* @see Drupal\Core\Entity\DatabaseStorageController * @see \Drupal\Core\Entity\DatabaseStorageController
* @see Drupal\Core\Entity\Query\QueryInterface * @see \Drupal\Core\Entity\Query\QueryInterface
*/ */
function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) {
$controller = Drupal::entityManager()->getStorageController($entity_type); $controller = Drupal::entityManager()->getStorageController($entity_type);
if ($reset) { if ($reset) {
$controller->resetCache(); $controller->resetCache($ids);
} }
return $controller->load($ids); return $controller->loadMultiple($ids);
} }
/** /**
...@@ -367,7 +369,7 @@ function entity_load_unchanged($entity_type, $id) { ...@@ -367,7 +369,7 @@ function entity_load_unchanged($entity_type, $id) {
*/ */
function entity_delete_multiple($entity_type, array $ids) { function entity_delete_multiple($entity_type, array $ids) {
$controller = Drupal::entityManager()->getStorageController($entity_type); $controller = Drupal::entityManager()->getStorageController($entity_type);
$entities = $controller->load($ids); $entities = $controller->loadMultiple($ids);
$controller->delete($entities); $controller->delete($entities);
} }
......
...@@ -559,7 +559,7 @@ function _menu_load_objects(&$item, &$map) { ...@@ -559,7 +559,7 @@ function _menu_load_objects(&$item, &$map) {
$return = $function($value); $return = $function($value);
} }
// If callback returned an error or there is no callback, trigger 404. // If callback returned an error or there is no callback, trigger 404.
if ($return === FALSE) { if (empty($return)) {
$item['access'] = FALSE; $item['access'] = FALSE;
$map = FALSE; $map = FALSE;
return FALSE; return FALSE;
......
...@@ -114,9 +114,9 @@ public static function createInstance(ContainerInterface $container, $entity_typ ...@@ -114,9 +114,9 @@ public static function createInstance(ContainerInterface $container, $entity_typ
} }
/** /**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::load(). * {@inheritdoc}
*/ */
public function load(array $ids = NULL) { public function loadMultiple(array $ids = NULL) {
$entities = array(); $entities = array();
// Create a new variable which is either a prepared version of the $ids // Create a new variable which is either a prepared version of the $ids
...@@ -152,6 +152,14 @@ public function load(array $ids = NULL) { ...@@ -152,6 +152,14 @@ public function load(array $ids = NULL) {
return $entities; return $entities;
} }
/**
* {@inheritdoc}
*/
public function load($id) {
$entities = $this->loadMultiple(array($id));
return isset($entities[$id]) ? $entities[$id] : NULL;
}
/** /**
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision(). * Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision().
*/ */
...@@ -170,7 +178,7 @@ public function deleteRevision($revision_id) { ...@@ -170,7 +178,7 @@ public function deleteRevision($revision_id) {
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadByProperties(). * Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadByProperties().
*/ */
public function loadByProperties(array $values = array()) { public function loadByProperties(array $values = array()) {
$entities = $this->load(); $entities = $this->loadMultiple();
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
$entities = array_filter($entities, function($entity) use ($key, $value) { $entities = array_filter($entities, function($entity) use ($key, $value) {
return $value === $entity->get($key); return $value === $entity->get($key);
...@@ -386,8 +394,7 @@ public function save(EntityInterface $entity) { ...@@ -386,8 +394,7 @@ public function save(EntityInterface $entity) {
if (!$is_new && !isset($entity->original)) { if (!$is_new && !isset($entity->original)) {
$this->resetCache(array($id)); $this->resetCache(array($id));
$result = $this->load(array($id)); $entity->original = $this->load($id);
$entity->original = reset($result);
} }
if ($id !== $entity->id()) { if ($id !== $entity->id()) {
...@@ -492,8 +499,7 @@ public function importCreate($name, Config $new_config, Config $old_config) { ...@@ -492,8 +499,7 @@ public function importCreate($name, Config $new_config, Config $old_config) {
*/ */
public function importUpdate($name, Config $new_config, Config $old_config) { public function importUpdate($name, Config $new_config, Config $old_config) {
$id = static::getIDFromConfigName($name, $this->entityInfo['config_prefix']); $id = static::getIDFromConfigName($name, $this->entityInfo['config_prefix']);
$entities = $this->load(array($id)); $entity = $this->load($id);
$entity = $entities[$id];
$entity->original = clone $entity; $entity->original = clone $entity;
foreach ($old_config->get() as $property => $value) { foreach ($old_config->get() as $property => $value) {
...@@ -523,8 +529,7 @@ public function importUpdate($name, Config $new_config, Config $old_config) { ...@@ -523,8 +529,7 @@ public function importUpdate($name, Config $new_config, Config $old_config) {
*/ */
public function importDelete($name, Config $new_config, Config $old_config) { public function importDelete($name, Config $new_config, Config $old_config) {
$id = static::getIDFromConfigName($name, $this->entityInfo['config_prefix']); $id = static::getIDFromConfigName($name, $this->entityInfo['config_prefix']);
$entities = $this->load(array($id)); $entity = $this->load($id);
$entity = $entities[$id];
$entity->delete(); $entity->delete();
return TRUE; return TRUE;
} }
......
...@@ -111,9 +111,9 @@ public function __construct($entity_type, array $entity_info, Connection $databa ...@@ -111,9 +111,9 @@ public function __construct($entity_type, array $entity_info, Connection $databa
} }
/** /**
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::load(). * {@inheritdoc}
*/ */
public function load(array $ids = NULL) { public function loadMultiple(array $ids = NULL) {
$entities = array(); $entities = array();
// Create a new variable which is either a prepared version of the $ids // Create a new variable which is either a prepared version of the $ids
...@@ -177,6 +177,14 @@ public function load(array $ids = NULL) { ...@@ -177,6 +177,14 @@ public function load(array $ids = NULL) {
return $entities; return $entities;
} }
/**
* {@inheritdoc}
*/
public function load($id) {
$entities = $this->loadMultiple(array($id));
return isset($entities[$id]) ? $entities[$id] : NULL;
}
/** /**
* Implements \Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision(). * Implements \Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision().
*/ */
...@@ -227,7 +235,7 @@ public function loadByProperties(array $values = array()) { ...@@ -227,7 +235,7 @@ public function loadByProperties(array $values = array()) {
$entity_query = \Drupal::entityQuery($this->entityType); $entity_query = \Drupal::entityQuery($this->entityType);
$this->buildPropertyQuery($entity_query, $values); $this->buildPropertyQuery($entity_query, $values);
$result = $entity_query->execute(); $result = $entity_query->execute();
return $result ? $this->load($result) : array(); return $result ? $this->loadMultiple($result) : array();
} }
/** /**
......
...@@ -87,7 +87,7 @@ public function getStorageController() { ...@@ -87,7 +87,7 @@ public function getStorageController() {
* Implements \Drupal\Core\Entity\EntityListControllerInterface::load(). * Implements \Drupal\Core\Entity\EntityListControllerInterface::load().
*/ */
public function load() { public function load() {
return $this->storage->load(); return $this->storage->loadMultiple();
} }
/** /**
......
...@@ -89,8 +89,7 @@ public function __construct($entity_type, $entity_info) { ...@@ -89,8 +89,7 @@ public function __construct($entity_type, $entity_info) {
*/ */
public function loadUnchanged($id) { public function loadUnchanged($id) {
$this->resetCache(array($id)); $this->resetCache(array($id));
$result = $this->load(array($id)); return $this->load($id);
return reset($result);
} }
/** /**
......
...@@ -38,7 +38,18 @@ public function resetCache(array $ids = NULL); ...@@ -38,7 +38,18 @@ public function resetCache(array $ids = NULL);
* @return * @return
* An array of entity objects indexed by their ids. * An array of entity objects indexed by their ids.
*/ */
public function load(array $ids = NULL); public function loadMultiple(array $ids = NULL);
/**
* Loads one entity.
*
* @param mixed $id
* The ID of the entity to load.
*
* @return \Drupal\Core\Entity\EntityInterface
* An entity object.
*/
public function load($id);
/** /**
* Loads an unchanged entity from the database. * Loads an unchanged entity from the database.
......
...@@ -92,10 +92,7 @@ public function process(array &$variables, Route $route, array &$converted) { ...@@ -92,10 +92,7 @@ public function process(array &$variables, Route $route, array &$converted) {
$value = $variables[$name]; $value = $variables[$name];
$storageController = $this->entityManager->getStorageController($type); $storageController = $this->entityManager->getStorageController($type);
$entities = $storageController->load(array($value)); $entity = $storageController->load($value);
// Make sure $entities is null, if upcasting fails.
$entity = $entities ? reset($entities) : NULL;
$variables[$name] = $entity; $variables[$name] = $entity;
// Mark this variable as converted. // Mark this variable as converted.
......
...@@ -114,8 +114,8 @@ public function form(array $form, array &$form_state) { ...@@ -114,8 +114,8 @@ public function form(array $form, array &$form_state) {
* TRUE if the action exists, FALSE otherwise. * TRUE if the action exists, FALSE otherwise.
*/ */
public function exists($id) { public function exists($id) {
$actions = $this->storageController->load(array($id)); $action = $this->storageController->load($id);
return isset($actions[$id]); return !empty($action);
} }
/** /**
......
...@@ -283,7 +283,7 @@ public function pageLast() { ...@@ -283,7 +283,7 @@ public function pageLast() {
*/ */
public function sources() { public function sources() {
$feeds = $this->entityManager->getStorageController('aggregator_feed')->load(); $feeds = $this->entityManager->getStorageController('aggregator_feed')->loadMultiple();
$build = array( $build = array(
'#type' => 'container', '#type' => 'container',
......
...@@ -202,7 +202,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -202,7 +202,7 @@ public function submitForm(array &$form, array &$form_state) {
->execute(); ->execute();
$result = $this->entityManager $result = $this->entityManager
->getStorageController('aggregator_feed') ->getStorageController('aggregator_feed')
->load($ids); ->loadMultiple($ids);
foreach ($result as $old) { foreach ($result as $old) {
if (strcasecmp($old->label(), $feed['title']) == 0) { if (strcasecmp($old->label(), $feed['title']) == 0) {
drupal_set_message(t('A feed named %title already exists.', array('%title' => $old->label())), 'warning'); drupal_set_message(t('A feed named %title already exists.', array('%title' => $old->label())), 'warning');
......
...@@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio
function titleQuery() { function titleQuery() {
$titles = array(); $titles = array();
$feeds = $this->entityManager->getStorageController('aggregator_feed')->load($this->value); $feeds = $this->entityManager->getStorageController('aggregator_feed')->loadMultiple($this->value);
foreach ($feeds as $feed) { foreach ($feeds as $feed) {
$titles[] = String::checkPlain($feed->label()); $titles[] = String::checkPlain($feed->label());
} }
......
...@@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -59,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio
function titleQuery() { function titleQuery() {
$titles = array(); $titles = array();
$items = $this->entityManager->getStorageController('aggregator_item')->load($this->value); $items = $this->entityManager->getStorageController('aggregator_item')->loadMultiple($this->value);
foreach ($items as $feed) { foreach ($items as $feed) {
$titles[] = String::checkPlain($feed->label()); $titles[] = String::checkPlain($feed->label());
} }
......
...@@ -121,8 +121,8 @@ function custom_block_theme($existing, $type, $theme, $path) { ...@@ -121,8 +121,8 @@ function custom_block_theme($existing, $type, $theme, $path) {
* @param int $id * @param int $id
* The ID of the custom block type to load. * The ID of the custom block type to load.
* *
* @return Drupal\custom_block\Plugin\Core\Entity\CustomBlockType|false * @return \Drupal\custom_block\Plugin\Core\Entity\CustomBlockType|null
* A CustomBlockType object or FALSE if the requested $id does not exist. * A CustomBlockType object or NULL if the requested $id does not exist.
*/ */
function custom_block_type_load($id) { function custom_block_type_load($id) {
return entity_load('custom_block_type', $id); return entity_load('custom_block_type', $id);
...@@ -134,8 +134,8 @@ function custom_block_type_load($id) { ...@@ -134,8 +134,8 @@ function custom_block_type_load($id) {
* @param int $id * @param int $id
* The id of the custom block. * The id of the custom block.
* *
* @return Drupal\custom_block\Plugin\Core\Entity\CustomBlock|false * @return \Drupal\custom_block\Plugin\Core\Entity\CustomBlock|null
* A CustomBlock object or FALSE if the requested $id does not exist. * A CustomBlock object or NULL if the requested $id does not exist.
*/ */
function custom_block_load($id) { function custom_block_load($id) {
return entity_load('custom_block', $id); return entity_load('custom_block', $id);
......
...@@ -77,7 +77,7 @@ public function __construct(PluginManagerInterface $entity_manager, EntityStorag ...@@ -77,7 +77,7 @@ public function __construct(PluginManagerInterface $entity_manager, EntityStorag
* returns the custom block add page for that custom block type. * returns the custom block add page for that custom block type.
*/ */
public function add(Request $request) { public function add(Request $request) {
$types = $this->customBlockTypeStorage->load(); $types = $this->customBlockTypeStorage->loadMultiple();
if ($types && count($types) == 1) { if ($types && count($types) == 1) {
$type = reset($types); $type = reset($types);
return $this->addForm($type, $request); return $this->addForm($type, $request);
......
...@@ -18,8 +18,8 @@ class BlockStorageController extends ConfigStorageController { ...@@ -18,8 +18,8 @@ class BlockStorageController extends ConfigStorageController {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function load(array $ids = NULL) { public function loadMultiple(array $ids = NULL) {
$entities = parent::load($ids); $entities = parent::loadMultiple($ids);
// Only blocks with a valid plugin should be loaded. // Only blocks with a valid plugin should be loaded.
return array_filter($entities, function ($entity) { return array_filter($entities, function ($entity) {
return $entity->getPlugin(); return $entity->getPlugin();
......
...@@ -116,8 +116,7 @@ protected function createTests() { ...@@ -116,8 +116,7 @@ protected function createTests() {
* Tests the rendering of blocks. * Tests the rendering of blocks.
*/ */
protected function loadTests() { protected function loadTests() {
$entities = $this->controller->load(array('stark.test_block')); $entity = $this->controller->load('stark.test_block');
$entity = reset($entities);
$this->assertTrue($entity instanceof Block, 'The loaded entity is a Block.'); $this->assertTrue($entity instanceof Block, 'The loaded entity is a Block.');
...@@ -182,8 +181,7 @@ protected function renderTests() { ...@@ -182,8 +181,7 @@ protected function renderTests() {
* Tests the deleting of blocks. * Tests the deleting of blocks.
*/ */
protected function deleteTests() { protected function deleteTests() {
$entities = $this->controller->load(array('stark.test_block')); $entity = $this->controller->load('stark.test_block');
$entity = reset($entities);
// Ensure that the storage isn't currently empty. // Ensure that the storage isn't currently empty.
$config_storage = $this->container->get('config.storage'); $config_storage = $this->container->get('config.storage');
...@@ -202,13 +200,13 @@ protected function deleteTests() { ...@@ -202,13 +200,13 @@ protected function deleteTests() {
* Tests the installation of default blocks. * Tests the installation of default blocks.
*/ */
public function testDefaultBlocks() { public function testDefaultBlocks() {
$entities = $this->controller->load(); $entities = $this->controller->loadMultiple();
$this->assertTrue(empty($entities), 'There are no blocks initially.'); $this->assertTrue(empty($entities), 'There are no blocks initially.');
// Install the block_test.module, so that its default config is installed. // Install the block_test.module, so that its default config is installed.
$this->installConfig(array('block_test')); $this->installConfig(array('block_test'));
$entities = $this->controller->load(); $entities = $this->controller->loadMultiple();
$entity = reset($entities); $entity = reset($entities);
$this->assertEqual($entity->id(), 'stark.test_block', 'The default test block was loaded.'); $this->assertEqual($entity->id(), 'stark.test_block', 'The default test block was loaded.');
} }
......
...@@ -75,10 +75,10 @@ protected function testDeleteBlockDisplay() { ...@@ -75,10 +75,10 @@ protected function testDeleteBlockDisplay() {
$view->displayHandlers->remove('block_1'); $view->displayHandlers->remove('block_1');
$view->storage->save(); $view->storage->save();
$this->assertFalse($block_storage_controller->load(array($block_1->id())), 'The block for this display was removed.'); $this->assertFalse($block_storage_controller->load($block_1->id()), 'The block for this display was removed.');
$this->assertFalse($block_storage_controller->load(array($block_2->id())), 'The block for this display was removed.'); $this->assertFalse($block_storage_controller->load($block_2->id()), 'The block for this display was removed.');
$this->assertTrue($block_storage_controller->load(array($block_3->id())), 'A block from another view was unaffected.'); $this->assertTrue($block_storage_controller->load($block_3->id()), 'A block from another view was unaffected.');
$this->assertTrue($block_storage_controller->load(array($block_4->id())), 'A block from another view was unaffected.'); $this->assertTrue($block_storage_controller->load($block_4->id()), 'A block from another view was unaffected.');
$this->drupalGet('test-page'); $this->drupalGet('test-page');
$this->assertNoBlockAppears($block_1); $this->assertNoBlockAppears($block_1);
$this->assertNoBlockAppears($block_2); $this->assertNoBlockAppears($block_2);
...@@ -92,8 +92,8 @@ protected function testDeleteBlockDisplay() { ...@@ -92,8 +92,8 @@ protected function testDeleteBlockDisplay() {
$view->displayHandlers->remove('block_1'); $view->displayHandlers->remove('block_1');
$view->storage->save(); $view->storage->save();
$this->assertFalse($block_storage_controller->load(array($block_3->id())), 'The block for this display was removed.'); $this->assertFalse($block_storage_controller->load($block_3->id()), 'The block for this display was removed.');
$this->assertTrue($block_storage_controller->load(array($block_4->id())), 'A block from another display on the same view was unaffected.'); $this->assertTrue($block_storage_controller->load($block_4->id()), 'A block from another display on the same view was unaffected.');
$this->drupalGet('test-page'); $this->drupalGet('test-page');
$this->assertNoBlockAppears($block_3); $this->assertNoBlockAppears($block_3);
$this->assertBlockAppears($block_4); $this->assertBlockAppears($block_4);
...@@ -114,18 +114,18 @@ public function testViewsBlockForm() { ...@@ -114,18 +114,18 @@ public function testViewsBlockForm() {
// Save the block. // Save the block.
$this->drupalPost(NULL, array(), t('Save block')); $this->drupalPost(NULL, array(), t('Save block'));
$storage = $this->container->get('plugin.manager.entity')->getStorageController('block'); $storage = $this->container->get('plugin.manager.entity')->getStorageController('block');
$blocks = $storage->load(array('stark.views_block__test_view_block_block_1')); $block = $storage->load('stark.views_block__test_view_block_block_1');
// This will only return a result if our new block has been created with the // This will only return a result if our new block has been created with the
// expected machine name. // expected machine name.
$this->assertTrue(!empty($blocks), 'The expected block was loaded.'); $this->assertTrue(!empty($block), 'The expected block was loaded.');
for ($i = 2; $i <= 3; $i++) { for ($i = 2; $i <= 3; $i++) {
// Place the same block again and make sure we have a new ID. // Place the same block again and make sure we have a new ID.
$this->drupalPost('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, array(), t('Save block')); $this->drupalPost('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, array(), t('Save block'));
$blocks = $storage->load(array('stark.views_block__test_view_block_block_1_' . $i)); $block = $storage->load('stark.views_block__test_view_block_block_1_' . $i);
// This will only return a result if our new block has been created with the // This will only return a result if our new block has been created with the
// expected machine name. // expected machine name.
$this->assertTrue(!empty($blocks), 'The expected block was loaded.'); $this->assertTrue(!empty($block), 'The expected block was loaded.');
} }
} }
......
...@@ -79,7 +79,7 @@ protected function loadBooks() { ...@@ -79,7 +79,7 @@ protected function loadBooks() {
$query->addMetaData('base_table', 'book'); $query->addMetaData('base_table', 'book');
$book_links = $query->execute(); $book_links = $query->execute();
$nodes = $this->entityManager->getStorageController('node')->load($nids); $nodes = $this->entityManager->getStorageController('node')->loadMultiple($nids);
foreach ($book_links as $link) { foreach ($book_links as $link) {
$nid = $link['nid']; $nid = $link['nid'];
......
...@@ -294,8 +294,8 @@ function breakpoint_get_module_media_queries($module) { ...@@ -294,8 +294,8 @@ function breakpoint_get_module_media_queries($module) {
* @param string $id * @param string $id
* The id of the breakpoint group to load. * The id of the breakpoint group to load.
* *
* @return Drupal\breakpoint\Plugin\Core\Entity\BreakpointGroup|false * @return \Drupal\breakpoint\Plugin\Core\Entity\BreakpointGroup|null
* The breakpoint group, or FALSE if there is no entity with the given id. * The breakpoint group, or NULL if there is no entity with the given id.
* *
* @todo Remove this in a follow-up issue. * @todo Remove this in a follow-up issue.
* @see http://drupal.org/node/1798214 * @see http://drupal.org/node/1798214
...@@ -310,8 +310,8 @@ function breakpoint_group_load($id) { ...@@ -310,8 +310,8 @@ function breakpoint_group_load($id) {
* @param int $id * @param int $id
* The id of the breakpoint to load. * The id of the breakpoint to load.
* *
* @return Drupal\breakpoint\Plugin\Core\Entity\Breakpoint * @return \Drupal\breakpoint\Plugin\Core\Entity\Breakpoint|null
* The entity object, or FALSE if there is no entity with the given id. * The entity object, or NULL if there is no entity with the given id.
* *
* @todo Remove this in a follow-up issue. * @todo Remove this in a follow-up issue.
* @see http://drupal.org/node/1798214 * @see http://drupal.org/node/1798214
......
...@@ -1195,7 +1195,7 @@ function comment_node_update_index(EntityInterface $node, $langcode) { ...@@ -1195,7 +1195,7 @@ function comment_node_update_index(EntityInterface $node, $langcode) {
// edit could change the security situation so it is not safe to index the // edit could change the security situation so it is not safe to index the
// comments. // comments.
$index_comments = TRUE; $index_comments = TRUE;
$roles = Drupal::entityManager()->getStorageController('user_role')->load(); $roles = Drupal::entityManager()->getStorageController('user_role')->loadMultiple();
$authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access comments'); $authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access comments');
foreach ($roles as $rid => $role) { foreach ($roles as $rid => $role) {
if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) { if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) {
......
...@@ -232,8 +232,8 @@ function contact_field_extra_fields() { ...@@ -232,8 +232,8 @@ function contact_field_extra_fields() {
* @param $id * @param $id
* The ID of the contact category to load. * The ID of the contact category to load.
* *