简体   繁体   English

Symfony2 Podio-Php podio API

[英]Symfony2 Podio-Php podio api

im supposed to use get item values but it is not in podio-php client, and i have little to no experience with api 即时通讯应该使用获取项目值,但它不在podio-php客户端中,并且我对api几乎没有经验

i have looked around and found a work around getting all the item id on app then looping through all the id and all the fields in the app problem is, its very slow, so am i doing something wrong? 我环顾四周,发现一种解决方法是获取应用程序上的所有项目ID,然后遍历所有ID和应用程序中的所有字段,问题很慢,所以我做错什么了吗?

here's some of my code 这是我的一些代码

foreach ($item_collection['items'] as $item_key => $item) {

        $pname[] = (\PodioItem::get_field_value($item->item_id, 46702393));
        $channel[] = (\PodioItem::get_field_value($item->item_id, 46702394));

and i have like more than 30 ids and 17 or so fields 我有30多个ID和17个左右的字段

PS: im using symfony2 PS:即时通讯使用symfony2

Since you have already gotten an item collection there's no need for any more API requests. 由于您已经获得了项目集合,因此不再需要任何API请求。 When you call PodioItem::get_field_value() inside a loop like that it will be extremely slow because you are making a request to a remote server. 当您在这样的循环内调用PodioItem :: get_field_value()时,它会非常慢,因为您正在向远程服务器发出请求。

In this case it's unnecessary because you already have all the data. 在这种情况下,这是不必要的,因为您已经拥有了所有数据。 $item contains all the field values: $item包含所有字段值:

foreach ($item_collection['items'] as $item_key => $item) {
    $pname[] = $item->field(46702393);
    $channel[] = $item->field(46702394);

$pname and $channel now contains an array of PodioItemField objects that you can work on. $ pname和$ channel现在包含可以处理的PodioItemField对象数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM