{"action":"created","issue":{"url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/10","repository_url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle","labels_url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/10/comments","events_url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/10/events","html_url":"https://github.com/hristonev/sportmonks-client-bundle/issues/10","id":352211857,"node_id":"MDU6SXNzdWUzNTIyMTE4NTc=","number":10,"title":"calling fixtures pagination in foreach loop","user":{"login":"kashmiry","id":4423561,"node_id":"MDQ6VXNlcjQ0MjM1NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/4423561?v=4","gravatar_id":"","url":"https://api.github.com/users/kashmiry","html_url":"https://github.com/kashmiry","followers_url":"https://api.github.com/users/kashmiry/followers","following_url":"https://api.github.com/users/kashmiry/following{/other_user}","gists_url":"https://api.github.com/users/kashmiry/gists{/gist_id}","starred_url":"https://api.github.com/users/kashmiry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kashmiry/subscriptions","organizations_url":"https://api.github.com/users/kashmiry/orgs","repos_url":"https://api.github.com/users/kashmiry/repos","events_url":"https://api.github.com/users/kashmiry/events{/privacy}","received_events_url":"https://api.github.com/users/kashmiry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-08-20T16:39:18Z","updated_at":"2018-08-21T06:31:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I am doing this call inside a foreach loop to return each competition matches. This call works just fine if it's outside a foreach loop. When in foreach I only get the first competition array but then the array is not reseted! it keeps returning the same results for the first loop, I tried to unset the variables but that does not seem to work. any idea?\r\n\r\n```\r\nforeach($comps as $comp){\r\n    $comp_api = $comp->comp_id;\r\n    $from_date = new datetime($start_date);\r\n    $to_date = new datetime($end_date);\r\n    $matches_setup = ['query' => ['leagues' => $comp_id]];\r\n\r\n    #loop matches\r\n    $matches = array();\r\n    do {\r\n        $matches = array_merge($matches, $api->fixtures()->between()->period($from_date, $to_date, null, $matches_setup));\r\n    } while ($monk_framework->fixtures()->nextPage($matches_setup));\r\n    $results = $matches;\r\n\r\n    /*\r\n    * part where data is inserted to db\r\n    */\r\n}\r\n```\r\nIs there something wrong with how am doing it?"},"comment":{"url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/comments/414564555","html_url":"https://github.com/hristonev/sportmonks-client-bundle/issues/10#issuecomment-414564555","issue_url":"https://api.github.com/repos/hristonev/sportmonks-client-bundle/issues/10","id":414564555,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDU2NDU1NQ==","user":{"login":"hristonev","id":5811972,"node_id":"MDQ6VXNlcjU4MTE5NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/5811972?v=4","gravatar_id":"","url":"https://api.github.com/users/hristonev","html_url":"https://github.com/hristonev","followers_url":"https://api.github.com/users/hristonev/followers","following_url":"https://api.github.com/users/hristonev/following{/other_user}","gists_url":"https://api.github.com/users/hristonev/gists{/gist_id}","starred_url":"https://api.github.com/users/hristonev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hristonev/subscriptions","organizations_url":"https://api.github.com/users/hristonev/orgs","repos_url":"https://api.github.com/users/hristonev/repos","events_url":"https://api.github.com/users/hristonev/events{/privacy}","received_events_url":"https://api.github.com/users/hristonev/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T06:31:07Z","updated_at":"2018-08-21T06:31:07Z","author_association":"OWNER","body":"```php\r\n        $data = [];\r\n        try{\r\n            do{\r\n                $data = array_merge($data, $this->client->fixtures()->between()->period(\r\n                    $startDate,\r\n                    $endDate\r\n                ));\r\n            }while($this->client->fixtures()->between()->nextPage());\r\n        }catch (MissingParameterException $exception){\r\n            return [\r\n                'error' => true,\r\n                'error_msg' => $exception->getMessage()\r\n            ];\r\n        }\r\n\r\n        $this->rateLimit = $this->client->getRateLimit();\r\n        $this->rateLimitRemaining = $this->client->getRateLimitRemaining();\r\n\r\n        return $data;\r\n```\r\nMy code for getting fixtures. You pass additional parameter league, but that can't be a problem."}}
{"actor":{"display_login":"hristonev"}}