#4 getCampaignEvents doesn't return a nextLink

open
nobody
None
5
2012-03-08
2012-03-08
Justin Clarke
No

In Collections.php, the function getCampaignEvents($url, $eventType) does not return a nextLink (to the next page of 50 results), unlike the similar getContactEvents($url, $eventType), which does. This makes it difficult to use if there are more than 50 events to pull.

I've attached a text file with suggested fixes.

First, I've updated getCampaignEvents (in Collections.php) and modelled it after getContactEvents which returns an array with two keys:
events (an array of the events that are returned)
nextLink (the link to the page with the next 50 results)

Second, I've updated the functions that call getCampaignEvents in the ConstantContact.php file. I noticed that the comments for these functions were inappropriately referring to Contacts rather than Campaigns, and updated the comments to indicate that the returned array now consists of the events/nextLink values.

Finally, the getCampaignEvents() fucntion in the ConstantContact.php file wasn't even working. I'm not sure what purpose this function serves, given the other functions underneath it, but I've updated it to work as (it seems) it was intended.

Discussion

  • Justin Clarke
    Justin Clarke
    2012-03-08

    Suggested code fixes

     
    Attachments