diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 708706e..ac30969 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -718,23 +718,6 @@ function entity_get_render_display(EntityInterface $entity, $view_mode) { } /** - * Returns the entity query object for this entity type. - * - * @param $entity_type - * The entity type, e.g. node, for which the query object should be - * returned. - * @param $conjunction - * AND if all conditions in the query need to apply, OR if any of them is - * enough. Optional, defaults to AND. - * - * @return \Drupal\Core\Entity\Query\QueryInterface - * The query object that can query the given entity type. - */ -function entity_query($entity_type, $conjunction = 'AND') { - return drupal_container()->get('entity.query')->get($entity_type, $conjunction); -} - -/** * Returns the entity query aggregate object for this entity type. * * @param $entity_type @@ -748,7 +731,7 @@ function entity_query($entity_type, $conjunction = 'AND') { * The query object that can query the given entity type. */ function entity_query_aggregate($entity_type, $conjunction = 'AND') { - return drupal_container()->get('entity.query')->getAggregate($entity_type, $conjunction); + return Drupal::service('entity.query')->getAggregate($entity_type, $conjunction); } /** diff --git a/core/includes/menu.inc b/core/includes/menu.inc index e59615c..6b62bf8 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1276,7 +1276,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = // Collect all the links set to be expanded, and then add all of // their children to the list as well. do { - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('menu_name', $menu_name) ->condition('expanded', 1) ->condition('has_children', 1) @@ -1371,7 +1371,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { } if (!isset($trees[$tree_cid])) { - $query = entity_query('menu_link'); + $query = Drupal::entityQuery('menu_link'); for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) { $query->sort('p' . $i, 'ASC'); } @@ -2830,7 +2830,7 @@ function _menu_navigation_links_rebuild($menu) { } // Find any item whose router path does not exist any more. - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('router_path', $paths, 'NOT IN') ->condition('external', 0) ->condition('updated', 0) @@ -2857,7 +2857,7 @@ function _menu_navigation_links_rebuild($menu) { function menu_load_links($menu_name) { $links = array(); - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('menu_name', $menu_name) // Order by weight so as to be helpful for menus that are only one level // deep. diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index e57f4bb..25ebce2 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -290,7 +290,7 @@ public function deleteRevision($revision_id) { */ public function loadByProperties(array $values = array()) { // Build a query to fetch the entity IDs. - $entity_query = entity_query($this->entityType); + $entity_query = \Drupal::entityQuery($this->entityType); $this->buildPropertyQuery($entity_query, $values); $result = $entity_query->execute(); return $result ? $this->load($result) : array(); diff --git a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php index 366a323..48b884c 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php @@ -37,7 +37,7 @@ public function getEntityType(); * For example, to find all entities containing both the Turkish 'merhaba' * and the Polish 'siema' within a 'greetings' text field: * @code - * $entity_ids = entity_query($entity_type) + * $entity_ids = Drupal::entityQuery($entity_type) * ->condition('greetings', 'merhaba', '=', 'tr'); * ->condition('greetings.value', 'siema', '=', 'pl'); * ->execute(); @@ -198,7 +198,7 @@ public function conditionGroupFactory($conjunction = 'AND'); * field containing 'shape' and 'color' columns. To find all drawings * containing both a red triangle and a blue circle: * @code - * $query = entity_query('drawing'); + * $query = Drupal::entityQuery('drawing'); * $group = $query->andConditionGroup() * ->condition('figures.color', 'red') * ->condition('figures.shape', 'triangle'); @@ -221,7 +221,7 @@ public function andConditionGroup(); * containing 'building_type' and 'color' columns. To find all green and * red bikesheds: * @code - * $query = entity_query('map'); + * $query = Drupal::entityQuery('map'); * $group = $query->orConditionGroup() * ->condition('attributes.color', 'red') * ->condition('attributes.color', 'green'); diff --git a/core/modules/block/custom_block/custom_block.admin.inc b/core/modules/block/custom_block/custom_block.admin.inc index 3451e5d..0a31891 100644 --- a/core/modules/block/custom_block/custom_block.admin.inc +++ b/core/modules/block/custom_block/custom_block.admin.inc @@ -67,7 +67,7 @@ function custom_block_type_delete_form($form, &$form_state, CustomBlockType $blo $message = t('Are you sure you want to delete %label?', array('%label' => $block_type->label())); - $blocks = entity_query('custom_block')->condition('type', $block_type->id())->execute(); + $blocks = Drupal::entityQuery('custom_block')->condition('type', $block_type->id())->execute(); if (!empty($blocks)) { drupal_set_title($message, PASS_THROUGH); $caption = '

' . format_plural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', array('%label' => $block_type->label())) . '

'; diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php index 717d659..0d20636 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php @@ -57,7 +57,7 @@ public function testHookCustomBlockLoad() { // Now, as part of the same page request, load a set of custom_blocks that contain // both basic and other bundle, and make sure the parameters passed to // custom_block_test_custom_block_load() are correctly updated. - $custom_blocks = entity_load_multiple('custom_block', entity_query('custom_block')->execute(), TRUE); + $custom_blocks = entity_load_multiple('custom_block', \Drupal::entityQuery('custom_block')->execute(), TRUE); $loaded_custom_block = end($custom_blocks); $this->assertEqual($loaded_custom_block->custom_block_test_loaded_ids, array( $custom_block1->id->value, diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php index 3ba7b0b..45b9de2 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php @@ -39,7 +39,7 @@ public function testPageEdit() { $this->drupalPost('block/add/basic', $edit, t('Save')); // Check that the block exists in the database. - $blocks = entity_query('custom_block')->condition('info', $edit['info'])->execute(); + $blocks = \Drupal::entityQuery('custom_block')->condition('info', $edit['info'])->execute(); $block = entity_load('custom_block', reset($blocks)); $this->assertTrue($block, 'Custom block found in database.'); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php index fcd0426..cba9a82 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php @@ -267,7 +267,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') { $target_type = $this->field['settings']['target_type']; $entity_info = entity_get_info($target_type); - $query = entity_query($target_type); + $query = \Drupal::entityQuery($target_type); if (!empty($this->instance['settings']['handler_settings']['target_bundles'])) { $query->condition($entity_info['entity_keys']['bundle'], $this->instance['settings']['handler_settings']['target_bundles'], 'IN'); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php index d7b2d84..99ebe15 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php @@ -78,7 +78,7 @@ public function testAutoCreate() { $new_title = $this->randomName(); // Assert referenced node does not exist. - $base_query = entity_query('node'); + $base_query = \Drupal::entityQuery('node'); $base_query ->condition('type', $this->referenced_type) ->condition('title', $new_title); @@ -100,7 +100,7 @@ public function testAutoCreate() { $referenced_nid = key($result); // Assert the referenced node is associated with referencing node. - $result = entity_query('node') + $result = \Drupal::entityQuery('node') ->condition('type', $this->referencing_type) ->execute(); diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc index f6ee8a2..a2b88b5 100644 --- a/core/modules/field/field.crud.inc +++ b/core/modules/field/field.crud.inc @@ -854,7 +854,7 @@ function field_purge_batch($batch_size) { // Retrieve all deleted field instances. We cannot use field_info_instances() // because that function does not return deleted instances. $instances = field_read_instances(array('deleted' => 1), array('include_deleted' => 1)); - $factory = drupal_container()->get('entity.query'); + $factory = Drupal::service('entity.query'); $info = entity_get_info(); foreach ($instances as $instance) { $entity_type = $instance['entity_type']; diff --git a/core/modules/field/field.module b/core/modules/field/field.module index ea95f60..bc12efe 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -1008,7 +1008,7 @@ function field_get_items(EntityInterface $entity, $field_name, $langcode = NULL) function field_has_data($field) { $field = field_info_field_by_id($field['id']); $columns = array_keys($field['columns']); - $factory = drupal_container()->get('entity.query'); + $factory = Drupal::service('entity.query'); foreach ($field['bundles'] as $entity_type => $bundle) { // Entity Query throws an exception if there is no base table. $entity_info = entity_get_info($entity_type); diff --git a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php index 0635f38..eabf59a 100644 --- a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php @@ -151,7 +151,7 @@ function testDeleteFieldInstance() { $bundle = reset($this->bundles); $field = reset($this->fields); $field_name = $field['field_name']; - $factory = drupal_container()->get('entity.query'); + $factory = \Drupal::service('entity.query'); // There are 10 entities of this bundle. $found = $factory->get('test_entity') @@ -223,7 +223,7 @@ function testPurgeInstance() { field_purge_batch($batch_size); // There are $count deleted entities left. - $found = entity_query('test_entity') + $found = \Drupal::entityQuery('test_entity') ->condition('fttype', $bundle) ->condition($field['field_name'] . '.deleted', 1) ->execute(); diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php index 7188736..89287f5 100644 --- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php +++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php @@ -549,7 +549,7 @@ private function getStandardMenuLink() { $mlid = 0; // Retrieve menu link id of the Log out menu link, which will always be on // the front page. - $query = entity_query('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('module', 'system') ->condition('router_path', 'user/logout'); $result = $query->execute(); diff --git a/core/modules/menu/menu.admin.inc b/core/modules/menu/menu.admin.inc index 4855887..0f1f4f3 100644 --- a/core/modules/menu/menu.admin.inc +++ b/core/modules/menu/menu.admin.inc @@ -74,7 +74,7 @@ function menu_overview_form($form, &$form_state) { $form['#attached']['css'] = array(drupal_get_path('module', 'menu') . '/menu.admin.css'); $links = array(); - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('menu_name', $form_state['menu']->id()); for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) { $query->sort('p' . $i, 'ASC'); @@ -379,7 +379,7 @@ function menu_edit_menu_name_exists($value) { $custom_exists = entity_load('menu', $value); // 'menu-' is added to the menu name to avoid name-space conflicts. $value = 'menu-' . $value; - $link_exists = entity_query('menu_link')->condition('menu_name', $value)->range(0,1)->count()->execute(); + $link_exists = Drupal::entityQuery('menu_link')->condition('menu_name', $value)->range(0,1)->count()->execute(); return $custom_exists || $link_exists; } diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index addca0f..7d8f304 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -210,7 +210,7 @@ function menu_enable() { $link->link_title = $menu->label(); $link->link_path = 'admin/structure/menu/manage/' . $menu->id(); - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('link_path', $link->link_path) ->condition('plid', $link->plid); $result = $query->execute(); @@ -467,7 +467,7 @@ function menu_node_save(EntityInterface $node) { */ function menu_node_predelete(EntityInterface $node) { // Delete all menu module links that point to this node. - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->nid) ->condition('module', 'menu'); $result = $query->execute(); @@ -490,7 +490,7 @@ function menu_node_prepare(EntityInterface $node) { // Give priority to the default menu $type_menus = variable_get('menu_options_' . $node->type, array('main' => 'main')); if (in_array($menu_name, $type_menus)) { - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->nid) ->condition('menu_name', $menu_name) ->condition('module', 'menu') @@ -502,7 +502,7 @@ function menu_node_prepare(EntityInterface $node) { } // Check all allowed menus if a link does not exist in the default menu. if (!$mlid && !empty($type_menus)) { - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->nid) ->condition('menu_name', array_values($type_menus), 'IN') ->condition('module', 'menu') diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php index 5180b3e..de04d97 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php @@ -349,7 +349,7 @@ protected function updateParentalStatus(EntityInterface $entity, $exclude = FALS // If plid == 0, there is nothing to update. if ($entity->plid) { // Check if at least one visible child exists in the table. - $query = entity_query($this->entityType); + $query = \Drupal::entityQuery($this->entityType); $query ->condition('menu_name', $entity->menu_name) ->condition('hidden', 0) @@ -433,7 +433,7 @@ protected function findParent(EntityInterface $entity, array $parent_candidates $parent = FALSE; $parent_path = substr($parent_path, 0, strrpos($parent_path, '/')); - $query = entity_query($this->entityType); + $query = \Drupal::entityQuery($this->entityType); $query ->condition('mlid', $entity->id(), '<>') ->condition('module', 'system') @@ -569,7 +569,7 @@ protected function moveChildren(EntityInterface $entity) { * The unique name of a menu. */ public function countMenuLinks($menu_name) { - $query = entity_query($this->entityType); + $query = \Drupal::entityQuery($this->entityType); $query ->condition('menu_name', $menu_name) ->count(); diff --git a/core/modules/menu_link/menu_link.module b/core/modules/menu_link/menu_link.module index eb0bc0f..3a3bf30 100644 --- a/core/modules/menu_link/menu_link.module +++ b/core/modules/menu_link/menu_link.module @@ -89,7 +89,7 @@ function menu_link_delete_multiple(array $mlids, $force = FALSE, $prevent_repare $controller = drupal_container()->get('plugin.manager.entity') ->getStorageController('menu_link'); if (!$force) { - $entity_query = entity_query('menu_link'); + $entity_query = Drupal::entityQuery('menu_link'); $group = $entity_query->orConditionGroup() ->condition('module', 'system', '<>') ->condition('updated', 0, '<>'); @@ -178,7 +178,7 @@ function menu_link_maintain($module, $op, $link_path, $link_title = NULL) { break; case 'delete': - $result = entity_query('menu_link')->condition('link_path', $link_path)->execute(); + $result = Drupal::entityQuery('menu_link')->condition('link_path', $link_path)->execute(); if (!empty($result)) { menu_link_delete_multiple($result); } diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index 66c6b59..25eddba 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -154,7 +154,7 @@ function node_access_test_page() { function node_access_entity_test_page() { $output = ''; try { - $result = entity_query('node') + $result = Drupal::entityQuery('node') ->condition('body.value', 'A', 'STARTS_WITH') ->execute(); if (!empty($result)) { diff --git a/core/modules/options/options.module b/core/modules/options/options.module index 793b07e..05cbed1 100644 --- a/core/modules/options/options.module +++ b/core/modules/options/options.module @@ -389,7 +389,7 @@ function options_field_update_forbid($field, $prior_field, $has_data) { function _options_values_in_use($field, $values) { if ($values) { $field = field_info_field_by_id($field['id']); - $factory = drupal_container()->get('entity.query'); + $factory = Drupal::service('entity.query'); foreach ($field['bundles'] as $entity_type => $bundle) { $result = $factory->get($entity_type) ->condition($field['field_name'] . '.value', $values) diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 3aeab60..ad746d5 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -115,7 +115,7 @@ function testEnableModulesInstallContainer() { $this->installSchema('node', array('node_type', 'node')); // Perform an entity query against node. - $query = entity_query('node'); + $query = \Drupal::entityQuery('node'); // Disable node access checks, since User module is not enabled. $query->accessCheck(FALSE); $query->condition('nid', 1); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php index 67f190e..985fefb 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php @@ -533,12 +533,12 @@ function testEntityNGRollback() { if (Database::getConnection()->supportsTransactions()) { // Check that the block does not exist in the database. - $ids = entity_query('entity_test')->condition('name', 'fail_insert')->execute(); + $ids = \Drupal::entityQuery('entity_test')->condition('name', 'fail_insert')->execute(); $this->assertTrue(empty($ids), 'Transactions supported, and entity not found in database.'); } else { // Check that the block exists in the database. - $ids = entity_query('entity_test')->condition('name', 'fail_insert')->execute(); + $ids = \Drupal::entityQuery('entity_test')->condition('name', 'fail_insert')->execute(); $this->assertFalse(empty($ids), 'Transactions not supported, and entity found in database.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php index 434311c..e6d796e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php @@ -115,7 +115,7 @@ public function setUp() { $entity->save(); $this->entities[] = $entity; } - $this->factory = drupal_container()->get('entity.query'); + $this->factory = \Drupal::service('entity.query'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index ae51625..958bfb5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -126,7 +126,7 @@ function setUp() { } $this->figures = $figures; $this->greetings = $greetings; - $this->factory = drupal_container()->get('entity.query'); + $this->factory = \Drupal::service('entity.query'); } /** @@ -459,7 +459,7 @@ protected function assertBundleOrder($order) { * The tags and metadata should propogate to the SQL query object. */ function testMetaData() { - $query = entity_query('test_entity'); + $query = \Drupal::entityQuery('test_entity'); $query ->addTag('efq_metadata_test') ->addMetaData('foo', 'bar') diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php index cccdc5f..f5c1c52 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -317,7 +317,7 @@ protected function assertMultilingualProperties($entity_type) { // Test property conditions and orders with multiple languages in the same // query. - $query = entity_query($entity_type); + $query = \Drupal::entityQuery($entity_type); $group = $query->andConditionGroup() ->condition('user_id', $properties[$default_langcode]['user_id'], '=', $default_langcode) ->condition('name', $properties[$default_langcode]['name'], '=', $default_langcode); @@ -332,7 +332,7 @@ protected function assertMultilingualProperties($entity_type) { $field_value = $this->randomString(); $entity->getTranslation($langcode)->set($this->field_name, array(array('value' => $field_value))); $entity->save(); - $query = entity_query($entity_type); + $query = \Drupal::entityQuery($entity_type); $default_langcode_group = $query->andConditionGroup() ->condition('user_id', $properties[$default_langcode]['user_id'], '=', $default_langcode) ->condition('name', $properties[$default_langcode]['name'], '=', $default_langcode); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php index d4d7451..3b666a0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php @@ -365,7 +365,7 @@ function testMenuHierarchy() { */ function testMenuHidden() { // Verify links for one dynamic argument. - $query = entity_query('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('router_path', 'menu-test/hidden/menu', 'STARTS_WITH') ->sort('router_path'); $result = $query->execute(); @@ -417,7 +417,7 @@ function testMenuHidden() { $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); // Verify links for two dynamic arguments. - $query = entity_query('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('router_path', 'menu-test/hidden/block', 'STARTS_WITH') ->sort('router_path'); $result = $query->execute(); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index dbdf6a5..4220738 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -21,7 +21,7 @@ function system_admin_config_page() { $blocks = array(); if ($system_link = entity_load_multiple_by_properties('menu_link', array('link_path' => 'admin/config', 'module' => 'system'))) { $system_link = reset($system_link); - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('link_path', 'admin/help', '<>') ->condition('menu_name', $system_link->menu_name) ->condition('plid', $system_link->id()) diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php index 8ca1afd..b3ce285 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php @@ -37,7 +37,7 @@ function testTaxonomyEfq() { $term = $this->createTerm($this->vocabulary); $terms[$term->tid] = $term; } - $result = entity_query('taxonomy_term')->execute(); + $result = \Drupal::entityQuery('taxonomy_term')->execute(); sort($result); $this->assertEqual(array_keys($terms), $result, 'Taxonomy terms were retrieved by entity query.'); $tid = reset($result); @@ -57,7 +57,7 @@ function testTaxonomyEfq() { $terms2[$term->tid] = $term; } - $result = entity_query('taxonomy_term') + $result = \Drupal::entityQuery('taxonomy_term') ->condition('vid', $vocabulary2->id()) ->execute(); sort($result); diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 2880a5d..fe4f615 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -504,7 +504,7 @@ function toolbar_toolbar() { */ function toolbar_get_menu_tree() { $tree = array(); - $query = entity_query('menu_link') + $query = Drupal::entityQuery('menu_link') ->condition('menu_name', 'admin') ->condition('module', 'system') ->condition('link_path', 'admin'); diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index 040b47d..3cc5dc2 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -118,7 +118,7 @@ function tour_preprocess_page(&$variables) { $path_alias = drupal_strtolower(drupal_container()->get('path.alias_manager')->getPathAlias($path)); foreach ($tours as $tour_id => $tour) { - // @todo replace this with an entity_query() that does path matching when + // @todo replace this with a Drupal::entityQuery() that does path matching when // http://drupal.org/node/1918768 lands. $pages = implode("\n", $tour->getPaths()); if (!drupal_match_path($path_alias, $pages) && (($path == $path_alias) || drupal_match_path($path, $pages))) { diff --git a/core/modules/translation_entity/translation_entity.admin.inc b/core/modules/translation_entity/translation_entity.admin.inc index 2537c84..c0a76fa 100644 --- a/core/modules/translation_entity/translation_entity.admin.inc +++ b/core/modules/translation_entity/translation_entity.admin.inc @@ -475,7 +475,7 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con foreach ($entity_types as $entity_type) { // How many entities will need processing? - $query = entity_query($entity_type); + $query = Drupal::entityQuery($entity_type); $count = $query ->exists($query_field) ->count() @@ -500,7 +500,7 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con $info = entity_get_info($entity_type); $offset = $context['sandbox']['progress_entity_type'][$entity_type]; - $query = entity_query($entity_type); + $query = Drupal::entityQuery($entity_type); $result = $query ->exists($query_field) ->sort($info['entity_keys']['id']) diff --git a/core/modules/views/views.module b/core/modules/views/views.module index f1cb911..7e08746 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -1057,7 +1057,7 @@ function views_get_all_views() { * Returns an array of all enabled views, as fully loaded $view objects. */ function views_get_enabled_views() { - $query = drupal_container()->get('entity.query')->get('view') + $query = Drupal::entityQuery('view') ->condition('status', TRUE) ->execute(); @@ -1068,7 +1068,7 @@ function views_get_enabled_views() { * Returns an array of all disabled views, as fully loaded $view objects. */ function views_get_disabled_views() { - $query = drupal_container()->get('entity.query')->get('view') + $query = Drupal::entityQuery('view') ->condition('status', FALSE) ->execute();