如何根据包含的表值对结果进行排序?

时间:2016-04-20 21:14:24

标签: cakephp orm cakephp-3.0

我有一个包含多个存储(属于属性)的列表。我可以根据StorageInt11.val对结果列表进行排序吗?

public function findList(Query $query, array $options)
{
    return $query
        ->where([
            'category_id' => $options['for']
        ])
        ->contain([
            'StorageDate.Properties', 
            'StorageDecimal1.Properties', 
            'StorageDecimal2.Properties', 
            'StorageInt11.Properties', 
            'StorageVarchar255.Properties', 
            'StorageText.Properties'
        ])
        // The following does not work:
        ->order(['StorageInt11.val' => 'desc'])
        ->hydrate(false)
        ->toArray();
}

我应该转到Collections sorting吗?

0 个答案:

没有答案