Проблемы с API Facebook и постраничные результаты с помощью курсоров. Моя функция продолжает возвращать 25, исходную установленную сумму.
function buildCampaignsArray($cursor, $campaigns = []) {
if ($cursor && (int) $cursor->count() > 0) {
foreach ($cursor as $campaign) {
$campaigns[] = $campaign;
}
return buildCampaignsArray($cursor->next($cursor), $campaigns);
} else {
return $campaigns;
}
}
$account = new \FacebookAds\Object\AdAccount('act_1589583164658726');
$campaigns = buildCampaignsArray(
$account->getCampaigns(array(
CampaignFields::NAME,
CampaignFields::OBJECTIVE,
), array(
CampaignFields::EFFECTIVE_STATUS => array(
ArchivableCrudObjectEffectiveStatuses::ACTIVE,
ArchivableCrudObjectEffectiveStatuses::PAUSED,
),
))
);
var_dump($campaigns); exit;
$campaigns = buildCampaignsArray(
$account->getCampaigns(array(
CampaignFields::NAME,
CampaignFields::OBJECTIVE,
), array(
CampaignFields::EFFECTIVE_STATUS => array(
ArchivableCrudObjectEffectiveStatuses::ACTIVE,
ArchivableCrudObjectEffectiveStatuses::PAUSED,
),
),
['limit' => 100]
)
);
Других решений пока нет …