LeaguePHP / LeagueWrap

League of Legend API wrapper
MIT License
20 stars 7 forks source link

Getting only single Static Data #4

Closed Kaz- closed 7 years ago

Kaz- commented 7 years ago

Hello.

I'm using $this->api->attachStaticData(); to attach Static Datas to my requests, but it seems there's a little issue with it.

For exemple when I call game api I only get a single Summoner Spell. (same issue with Items)

$gameApi = $this->api->game();
$lastGames = $gameApi->recent($summoner);

This actually returns the following :

"summonerSpellStaticData": {
     "info": {
        "name": "Flash",
        "description": "Teleports your champion a short distance toward your cursor's location.",
        "summonerLevel": 8,
        "id": 4,
        "key": "SummonerFlash"
       }
}

Am I doing something wrong ? Or is it a bug ?

I'm trying to dig up into source code, but it's a bit complicated for someone who isn't in the project :/

Do you guys have the same issue , or is it something in my app going wrong ?

nohanna commented 7 years ago

I have the same issue, it returns only one StaticData on summoner spells and items. I don't think this is your app.

m1so commented 7 years ago

This should fix the issue. Now summonerSpellStaticData etc. should be an array of objects like so:

screen shot 2016-11-19 at 23 59 25

Let me know if it would be better for your usecase to use associative array with id as key @Kaz- @nohanna

nohanna commented 7 years ago

Good for me. Thank you @m1so for your help !