Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento-反转收藏的最佳方式_Magento_Collections_Reverse - Fatal编程技术网

Magento-反转收藏的最佳方式

Magento-反转收藏的最佳方式,magento,collections,reverse,Magento,Collections,Reverse,撤消使用新建Varien\u Data\u collection()创建的自定义集合的最佳方法是什么?集合是否已加载?该类支持setOrder,因此如果您知道它是如何排序的,并且它还没有加载,您可以在同一字段上调用setOrder,根据需要使用Varien_Data_Collection::SORT_ORDER_DESC或Varien_Data_Collection::SORT_ORDER_ASC。或者,如果您只需要对象,而不需要特定于可以使用的集合的对象 // where $collectio

撤消使用
新建Varien\u Data\u collection()
创建的自定义集合的最佳方法是什么?

集合是否已加载?该类支持setOrder,因此如果您知道它是如何排序的,并且它还没有加载,您可以在同一字段上调用setOrder,根据需要使用
Varien_Data_Collection::SORT_ORDER_DESC
Varien_Data_Collection::SORT_ORDER_ASC
。或者,如果您只需要对象,而不需要特定于可以使用的集合的对象

// where $collection is your instance of Varien_Data_Collection
$reversedCollection = array_reverse($collection->toArray());