-
Notifications
You must be signed in to change notification settings - Fork 22
Fix lazy api loading #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix lazy api loading #169
Conversation
| 'authorization' => get_class($api->getAuthorization()), | ||
| 'url' => $this->apiLink->link($api->getEndpoint()), | ||
| 'params' => $this->createParamsList($api->getHandler()), | ||
| 'params' => $this->createParamsList($this->apiDecider->getHandler($api)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
takto som to mal predtym? ten kod tu https://github.com/tomaj/nette-api/pull/149/changes je iny. Mame podla mna tie lazy handlery na eboxe a toto som tam nerobil urcite 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No to mi vyhadzuje pstan ze nemoze byt string v tych funkciach cize potrebujeme tam iba ApiHandler. A v API moze byt aj string ulozeny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a nemoze? nejde to tak? nie je to len zly typehint a phpstan je zmateny?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
predtym sa ale volalo
$versionApis = array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) {
return $version === $api->getEndpoint()->getVersion();
});
a getApis() spravilo pre kazde Api to, ze zmenilo string na Handler
$handler = $this->getHandler($api);
Ano podla PHPStanu to nefungujuje lebo stale si mysli ze je tam string alebo Handler, to sedi. Ale runtime-ovo to podla mna funguje spravne. Ty si zduplikoval to volanie podla mna.
| $list = []; | ||
| foreach ($versionApis as $api) { | ||
| $handler = $api->getHandler(); | ||
| $handler = $this->apiDecider->getHandler($api); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toto sa uz urobilo v getApis, checkni ale podla mna to druhykrat netreba robit
| $this->sendCorsHeaders(); | ||
|
|
||
| $api = $this->getApi($request); | ||
| $handler = $api->getHandler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApi uz vrati Api s tym ze handler nie je string ale Handler
| } | ||
|
|
||
| private function getHandler(Api $api): ApiHandlerInterface | ||
| public function getHandler(Api $api): ApiHandlerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zbytocne aby to bola public metoda, lebo zvonku ju volat nepotrebujes. Vola ju getApi() aj getApis()


No description provided.