aggregating responses for a PodioItem:filter() call

北城以北 提交于 2020-01-06 12:55:16

问题


I am trying to find a good way to combine multiple responses from PodioItem::filter into one array, or even one PodioItemCollection.

Assuming there 221 items in a podio app, and I was using a limit of 100, then I would get 3 responses of 100, 100, and 33. After getting them I would like to work with them as a one array or PodioCollection.

How can add to append the PodioItemCollections together? I think the offsetSet() function only adds one Item at a time.

Currently I am using the _get_items() function which is supposedly not kosher as its markws ** internal only **

$list = Array();
$x=0;
do {
  $ret_items = PodioItem:filter(appid,array('limit'=> 100, 'offset' => $x));
  $list = array_merge($list, $ret_items->_get_items());
  $x=$x+100;
} while (count($ret_items) == 100);

回答1:


You can just append one to the other?

$collection_a = PodioItem::filter();
$collection_b = PodioItem::filter();

foreach ($collection_b as $item) {
  $collection_a[] = $item;
}


来源:https://stackoverflow.com/questions/27561293/aggregating-responses-for-a-podioitemfilter-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!