Question

im supposed to use get item values but it is not in podio-php client, and i have little to no experience with 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?

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

PS: im using symfony2

Était-ce utile?

La solution

Since you have already gotten an item collection there's no need for any more API requests. 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.

In this case it's unnecessary because you already have all the data. $item contains all the field values:

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top