/** * Finds a partial list (given limit and offset) of registered subjects that * that represent a dependency on something like a subject in a query list, * a property, or a printrequest. * * `s_id` contains the subject id that links to the query that fulfills one * of the conditions cited above. * * Prefetched Ids are turned into a hash list that can later be split into * chunks to work either in online or batch mode without creating a huge memory * foothold. * * @note Select a list is crucial for performance as any selectRow would / * single Id select would strain the system on large list connected to a * query * * @since 2.3 * * @param array $idlist * @param RequestOptions $requestOptions * * @return array */ public function findEmbeddedQueryTargetLinksHashListFor(array $idlist, RequestOptions $requestOptions) { if ($idlist === array() || !$this->isEnabled()) { return array(); } $options = array('LIMIT' => $requestOptions->getLimit(), 'OFFSET' => $requestOptions->getOffset(), 'GROUP BY' => 's_id', 'ORDER BY' => 's_id', 'DISTINCT' => true); $conditions = array('o_id' => $idlist); foreach ($requestOptions->getExtraConditions() as $extraCondition) { $conditions += $extraCondition; } $rows = $this->connection->select(SQLStore::QUERY_LINKS_TABLE, array('s_id'), $conditions, __METHOD__, $options); $targetLinksIdList = array(); foreach ($rows as $row) { $targetLinksIdList[] = $row->s_id; } if ($targetLinksIdList === array()) { return array(); } return $this->store->getObjectIds()->getDataItemPoolHashListFor($targetLinksIdList); }
public function testOffset() { $instance = new RequestOptions(); $instance->setOffset(42); $this->assertEquals(42, $instance->getOffset()); }