diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php index e92689c345..f04e918adc 100644 --- a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php @@ -15,7 +15,7 @@ * PagerSelectExtender last, so that its range and count are based on the full * query. */ -class PagerSelectExtender extends SelectExtender { +class PagerSelectExtender extends SelectExtender implements PagerSelectExtenderInterface { /** * The number of elements per page to allow. @@ -61,10 +61,7 @@ public function __construct( } /** - * Override the execute method. - * - * Before we run the query, we need to add pager-based range() instructions - * to it. + * {@inheritdoc} */ public function execute() { // By calling preExecute() here, we force it to preprocess the extender @@ -101,27 +98,14 @@ protected function ensureElement() { } /** - * Specify the count query object to use for this pager. - * - * You will rarely need to specify a count query directly. If not specified, - * one is generated off of the pager query itself. - * - * @param \Drupal\Core\Database\Query\SelectInterface $query - * The count query object. It must return a single row with a single column, - * which is the total number of records. + * {@inheritdoc} */ public function setCountQuery(SelectInterface $query) { $this->customCountQuery = $query; } /** - * Retrieve the count query for this pager. - * - * The count query may be specified manually or, by default, taken from the - * query we are extending. - * - * @return \Drupal\Core\Database\Query\SelectInterface - * A count query object. + * {@inheritdoc} */ public function getCountQuery() { if ($this->customCountQuery) { @@ -133,13 +117,7 @@ public function getCountQuery() { } /** - * Specify the maximum number of elements per page for this query. - * - * The default if not specified is 10 items per page. - * - * @param int|false $limit - * An integer specifying the number of elements per page. If passed a false - * value (FALSE, 0, NULL), the pager is disabled. + * {@inheritdoc} */ public function limit($limit = 10) { $this->limit = $limit; @@ -147,20 +125,7 @@ public function limit($limit = 10) { } /** - * Specify the element ID for this pager query. - * - * The element is used to differentiate different pager queries on the same - * page so that they may be operated independently. If you do not specify an - * element, every pager query on the page will get a unique element. If for - * whatever reason you want to explicitly define an element for a given query, - * you may do so here. - * - * Note that no collision detection is done when setting an element ID - * explicitly, so it is possible for two pagers to end up using the same ID - * if both are set explicitly. - * - * @param $element - * Element ID that is used to differentiate different pager queries. + * {@inheritdoc} */ public function element($element) { $this->element = $element; @@ -169,14 +134,7 @@ public function element($element) { } /** - * Gets the element ID for this pager query. - * - * The element is used to differentiate different pager queries on the same - * page so that they may be operated independently. - * - * @return int - * Element ID that is used to differentiate between different pager - * queries. + * {@inheritdoc} */ public function getElement(): int { $this->ensureElement(); diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactory.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactory.php index dc8aac6069..e6757e5bde 100644 --- a/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactory.php +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactory.php @@ -8,7 +8,7 @@ /** * Select extender factory for pager queries. */ -class PagerSelectExtenderFactory { +class PagerSelectExtenderFactory implements PagerSelectExtenderFactoryInterface { /** * Constructs a PagerSelectExtenderFactory object. @@ -29,10 +29,10 @@ public function __construct( * @param \Drupal\Core\Database\Connection $connection * Database connection object. * - * @return \Drupal\Core\Database\Query\PagerSelectExtender + * @return \Drupal\Core\Database\Query\PagerSelectExtenderInterface * A query extender for pager queries. */ - public function get(SelectInterface $query, Connection $connection): PagerSelectExtender { + public function get(SelectInterface $query, Connection $connection): PagerSelectExtenderInterface { return new PagerSelectExtender($query, $connection, $this->pagerManager); } diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactoryInterface.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactoryInterface.php new file mode 100644 index 0000000000..0f07690ca7 --- /dev/null +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtenderFactoryInterface.php @@ -0,0 +1,25 @@ +