我只需要获取type = 0的记录但是在查询之后,我获得了所有类型的所有记录
public function findPeople() {
$query = $this->peopleRepository->createQuery();
$query->equals('type', 0);
$query->setOrderings(
array(
'uid' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
)
);
return $query->execute();
}
/**
* action people
*
* @return void
*/
public function listAction()
{
$people = $this->findPeople();
$this->view->assign('people', $people);
}
答案 0 :(得分:4)
您需要在存储库方法中添加matching()方法:
public function findPeople() {
$query = $this->peopleRepository->createQuery();
$query->matching($query->equals('type', 0));
$query->setOrderings(
array(
'uid' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
)
);
return $query->execute();
}