php - extbase (TYPO3) 中的 setOrderings 用于数组的第二层

标签 php typo3 extbase

我想通过我的 TYPO3 扩展的 EventRepository 中的这个函数按日期对我的“约会”进行排序。

    public function findAll() {

    // Sort appointments ascending
    $query = $this->createQuery();
    Return $query->setOrderings (
        Array('appointments' => Tx_Extbase_Persistence_Query::ORDER_ASCENDING)
    )->execute();

}

我需要获取数组的第二层,例如:'appointments.start_date' 我的阵列看起来像这样:

images => 'originalPreviewJW__2_.jpg' (25 chars)
     categories => Tx_Extbase_Persistence_ObjectStorageprototype object (2 items)
     appointments => Tx_Extbase_Persistence_ObjectStorageprototype object (4 items)
        000000006052eef7000000009b41588e => Tx_SzEvents_Domain_Model_Appointmentprototypepersistent entity (uid=3, pid=13)
              titel => 'entertainment area' (18 chars)
              startDate => DateTimeprototype object (2013-08-22T10:00:00+02:00, 1377158400)
              endDate => DateTimeprototype object (2013-08-22T20:00:00+02:00, 1377194400)

最佳答案

这应该可行

public function findAll() {
    // Sort appointments ascending
    $query = $this->createQuery();
    return $query->setOrderings (
        Array('appointments.startDate' => Tx_Extbase_Persistence_Query::ORDER_ASCENDING)
    )->execute();
}

关于php - extbase (TYPO3) 中的 setOrderings 用于数组的第二层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18126156/

相关文章:

php - TYPO3 延迟加载错误

javascript - 如何使用 f :form. select 和 onclick:

localization - FAL FileReferences 未在 FE 中本地化

php - jquery 固定 div 滚动,平滑移动

php - 返回第 2 列等于 1(第 3 列)的所有记录,而不在第 2 列中搜索

typo3 - 更改 TYPO3 扩展 tx_news 中 Flexform 选择项的标签

mysql - TYPO3 Extbase 扩展 : Where do i find the MySql database tables for each class of the extension?

TYPO3 Extbase 后端删除对象的单独代码

javascript - 是否有一个公式可以找到在一组中实现唯一性所需的最短长度

php - 是否可以读取第 3 方 cookie