You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
webleit/revisoapi version 2.0.0 with illuminate/collections v8.83.27 on PHP 8.1.27
$reviso->provinces->get();
launch an exception:
PHP Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /opt/project/vendor/illuminate/collections/Collection.php:508
Stack trace:
#0 /opt/project/vendor/webleit/revisoapi/src/Collection.php(17): Illuminate\Support\Collection->keyBy(Object(Closure))
#1 /opt/project/vendor/webleit/revisoapi/src/Endpoint/ListEndpoint.php(48): Weble\RevisoApi\Collection::create(Object(Weble\RevisoApi\Client), Object(stdClass), 'countryCode')
#2 /opt/project/vendor/webleit/revisoapi/src/Endpoint/Endpoint.php(43): Weble\RevisoApi\Endpoint\ListEndpoint->get()
Problem is inside illuminate/collections/Collection.php on function keyBy that try to cast the StdClass object as string.
public function keyBy($keyBy)
{
$keyBy = $this->valueRetriever($keyBy);
$results = [];
foreach ($this->items as $key => $item) {
$resolvedKey = $keyBy($item, $key);
if (is_object($resolvedKey)) {
$resolvedKey = (string) $resolvedKey;
}
$results[$resolvedKey] = $item;
}
return new static($results);
}
Hi, that's an endpoint we don't yet use.
We deduce how to read from the api endpoints from the json resources schema reviso provides, and automatically deduce how they work
Provinces is an experimental endpoint according to reviso, and it does seem that it doesn't follow the rest of the endpoints.
If you can / want you can PR a fix. This consists in creating a dedicated Endpoint class that fixes the differences, usually either the route lists method or the resource key one.
You can check the ProjectsEndpoint class for an example
webleit/revisoapi version 2.0.0 with illuminate/collections v8.83.27 on PHP 8.1.27
$reviso->provinces->get();
launch an exception:
Problem is inside illuminate/collections/Collection.php on function keyBy that try to cast the StdClass object as string.
The json received from reviso is the following:
The same if I try to filter/search a single province.
$reviso->provinces->where('code', '=', 'MI')->get();
How can I retrive information for this endpoint?
The text was updated successfully, but these errors were encountered: