如何仅渲染特定uid范围内的记录?让我们说我只想渲染它所在的记录。高于100且低于200
/**
* action list
*
* @return void
*/
public function listAction() {
$this->view->assign('records', $this->testRepository->findAll());
}
我是否需要使用MathUtility并且它是isIntegerInRange ...但是如何?
答案 0 :(得分:4)
在存储库中使用您自己的功能。
控制器
/**
* action list
*
* @param integer $minUid
* @param integer $maxUid
* @return void
*/
public function listAction() {
$this->view->assign('records', $this->testRepository->findUidRange($minUid,$maxUid));
}
存储库
/**
* Find records filtered by uid from to
*
* @param integer $minUid
* @param integer $maxUid
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result
*/
public function findUidRange($minUid = NULL, $maxUid = NULL) {
$query = $this->createQuery();
return $query->matching(
$query->logicalAnd(
$query->greaterThan('uid', $minUid),
$query->lessThan('uid', $maxUid),
$query->equals('deleted', 0)
))->execute();
}