TYPO3 extbase equals 不起作用
TYPO3 extbase equals does not work
我只需要获取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);
}
您需要在存储库方法中添加 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();
}
我只需要获取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);
}
您需要在存储库方法中添加 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();
}