public function DatabaseTestController::pagerQueryOdd in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php \Drupal\database_test\Controller\DatabaseTestController::pagerQueryOdd()
Runs a pager query and returns the results.
This function does care about the page GET parameter, as set by the simpletest HTTP call.
Return value
\Symfony\Component\HttpFoundation\JsonResponse
1 string reference to 'DatabaseTestController::pagerQueryOdd'
- database_test.routing.yml in core/
modules/ system/ tests/ modules/ database_test/ database_test.routing.yml - core/modules/system/tests/modules/database_test/database_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ database_test/ src/ Controller/ DatabaseTestController.php, line 68 - Contains \Drupal\database_test\Controller\DatabaseTestController.
Class
- DatabaseTestController
- Controller routines for database_test routes.
Namespace
Drupal\database_test\ControllerCode
public function pagerQueryOdd($limit) {
$query = db_select('test_task', 't');
$query
->fields('t', array(
'task',
))
->orderBy('pid');
// This should result in 4 pages of results.
$query = $query
->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')
->limit($limit);
$names = $query
->execute()
->fetchCol();
return new JsonResponse(array(
'names' => $names,
));
}