protected function ContentEntityDatasourceTest::getItemIds in Search API 8
Retrieves the IDs of all matching items from the test datasource.
Will automatically use paging to go through the entire result set.
If both $bundles and $languages are specified, they are combined with OR.
Parameters
string[]|null $bundles: (optional) The bundles for which all item IDs should be returned; or NULL to retrieve IDs from all enabled bundles in this datasource.
string[]|null $languages: (optional) The languages for which all item IDs should be returned; or NULL to retrieve IDs from all enabled languages in this datasource.
Return value
string[] All discovered item IDs.
Overrides ExampleContentTrait::getItemIds
See also
\Drupal\search_api\Plugin\search_api\datasource\ContentEntity::getPartialItemIds()
1 call to ContentEntityDatasourceTest::getItemIds()
- ContentEntityDatasourceTest::testItemDiscovery in tests/
src/ Kernel/ Datasource/ ContentEntityDatasourceTest.php - Verifies that paged item discovery works correctly.
File
- tests/
src/ Kernel/ Datasource/ ContentEntityDatasourceTest.php, line 299
Class
- ContentEntityDatasourceTest
- Tests correct functionality of the content entity datasource.
Namespace
Drupal\Tests\search_api\Kernel\DatasourceCode
protected function getItemIds(array $bundles = NULL, array $languages = NULL) {
$discovered_ids = [];
for ($page = 0;; ++$page) {
$new_ids = $this->datasource
->getPartialItemIds($page, $bundles, $languages);
if ($new_ids === NULL) {
break;
}
$discovered_ids = array_merge($discovered_ids, $new_ids);
}
sort($discovered_ids);
return $discovered_ids;
}