微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 用于数组第二级的extbase(TYPO3)中的setOrderings

我希望通过此函数在我的TYPO3扩展的EventRepository中按日期排序我的“约会”.

    public function findAll() {

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

}

我需要获得数组的第二级,例如:’appointmentments.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();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐