paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

[Leagues] Help #108

Closed n4ndo closed 8 years ago

n4ndo commented 8 years ago

Hello,

im trying to get the leagues result from a search in this way:

$api->summoner();
$summoner = $api->summoner()->info($summonerName); // Get the Profile information about this user.

$api->league(); // Init the League Object
$league = $api->league()->league($summoner->id); // Works if i print_r give all entries.
$leagueSummoner = $summoner->league($summoner->name)->entry($summoner->id);

I have this result:

Fatal error: Call to a member function entry() on null in D:\xampp\htdocs\app\controllers\GameController.php on line 165

Any idea what im doing wrong?

Thanks.

dnlbauer commented 8 years ago

If you want the league information to be stored in the summoner object, you need to pass the summoner object to league(), and not only it's Id.

On Wed, Mar 9, 2016, 9:20 PM Nano notifications@github.com wrote:

Hello,

im trying to get the leagues result from a search in this way:

            //echo $summoner->id; // Gives ID From summoner - Works
            $api->league(); // Init the League Object
            $league = $api->league()->league($summoner->id);
            $leagueSummoner = $summoner->league($summoner->name)->entry($summoner->id);

I have this result:

Fatal error: Call to a member function entry() on null in D:\xampp\htdocs\app\controllers\GameController.php on line 165

Any idea what im doing wrong?

Thanks.

— Reply to this email directly or view it on GitHub https://github.com/paquettg/leaguewrap/issues/108.

n4ndo commented 8 years ago

Hello @danijoo thanks for your answer.

Im just trying to replicate: https://github.com/paquettg/leaguewrap/blob/master/tests/Api/LeagueTest.php#L87

dnlbauer commented 8 years ago

Does it work now?

On Thu, Mar 10, 2016, 4:48 AM Nano notifications@github.com wrote:

Hello @danijoo https://github.com/danijoo thanks for your answer.

Im just trying to replicate: https://github.com/paquettg/leaguewrap/blob/master/tests/Api/LeagueTest.php#L87

— Reply to this email directly or view it on GitHub https://github.com/paquettg/leaguewrap/issues/108#issuecomment-194649868 .

n4ndo commented 8 years ago

Hello @danijoo, no, this is a little bit weird, this is part of an old test-project code, that was working, just updated to leaguewrap master and somethings broke after.

the original code is:

$region = "";
$summonerName = $this->disinfect->xss_clean(trim(strtolower("")));

$api = $this->leagueStart;
$api->setRegion($region);

$api->summoner();

$summoner = $api->summoner()->info($summonerName); // Get the Profile information about this user.
$teamSummoner = $api->team()->team($summoner->id); // Teams

$api->league(); // Init the League Object
$api->league($summoner); // Get the leagues Information about this user
$league = $api->league()->league($summoner->id);
$leagueSummoner = $summoner->league($summoner->name)->entry($summoner->id);

the before code was working.

Cordially

dnlbauer commented 8 years ago

Same issue as above. You are still passing a summoner Id to league and not the summoner object.

On Thu, Mar 10, 2016, 6:01 PM Nano notifications@github.com wrote:

no, this is a little bit weird, this is part of an old test-project code, that was working, just update to leaguewrap master and somethings broke after.

the original code is:

    $region = "";        $summonerName = $this->disinfect->xss_clean(trim(strtolower("")));        $api = $this->leagueStart;        $api->setRegion($region);                $api->summoner();                $summoner = $api->summoner()->info($summonerName); // Get the Profile information about this user.                $teamSummoner = $api->team()->team($summoner->id); // Teams

            $api->league(); // Init the League Object

            $api->league($summoner); // Get the leagues Information about this user

            $league = $api->league()->league($summoner->id);                $leagueSummoner = $summoner->league($summoner->name)->entry($summoner->id);

Reply to this email directly or view it on GitHub https://github.com/paquettg/leaguewrap/issues/108#issuecomment-194956393 .

dnlbauer commented 8 years ago

I dont see where your problem is. just pass the summoner...

$league = $api->league()->league($summoner);

n4ndo commented 8 years ago

thank you very much for your help and time, just returning to code on PHP...

$api->summoner();
$summoner = $api->summoner()->info($summonerName); // Get the Profile information about this user.

$api->league(); // Init the League Object
$league = $api->league()->league($summoner); // Works if i print_r give all entries.
$leagueSummoner = $summoner->league($summoner->name)->entry($summoner->id);

Works