aggregating responses for a PodioItem:filter() cal

2019-09-17 04:51发布

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);

标签: php podio
1条回答
Juvenile、少年°
2楼-- · 2019-09-17 05:50

You can just append one to the other?

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

foreach ($collection_b as $item) {
  $collection_a[] = $item;
}
查看更多
登录 后发表回答