小编Kar*_*hik的帖子

如何在 Typo3 的默认存储库功能中设置排序?

我是这样写的

/**
 * itemRepository
 *
 * @var \KRT\KrtEmployee\Domain\Repository\ItemRepository
 * @inject
 */
 protected $itemRepository = null;

/**
 * action list
 *
 * @return void
 */
public function listAction()
{
    $arguments =$this->request->getArguments();     

    $employees = $this->itemRepository->findAll();        
    $this->view->assign('employees',$employees);
}
Run Code Online (Sandbox Code Playgroud)

在我的$employees结果中,我有

  • 员工 ID(默认 uid)
  • 姓名
  • 指定
  • 部门
  • 薪水

现在,我怎样才能在排序结果数组升序基于订单

  1. 姓名
  2. 部门及薪资

是否有任何默认功能可以在存储库查询中进行排序?

php typo3 typo3-extensions typo3-7.6.x typo3-8.x

2
推荐指数
1
解决办法
4113
查看次数

标签 统计

php ×1

typo3 ×1

typo3-7.6.x ×1

typo3-8.x ×1

typo3-extensions ×1