Skip to content
Snippets Groups Projects
Commit ff0220b3 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix php8 warnings and variable access in stock images routes, fixes #4378

Closes #4378

Merge request studip/studip!3184
parent 17b24ac5
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,9 @@ class StockImagesCreate extends JsonApiController
*/
public function __invoke(Request $request, Response $response, $args): Response
{
$json = $this->validate($request, $resource);
$json = $this->validate($request);
$user = $this->getUser($request);
if (!Authority::canCreateStockImage($user, $resource)) {
if (!Authority::canCreateStockImage($user)) {
throw new AuthorizationFailedException();
}
$resource = $this->createResource($json);
......
......@@ -84,7 +84,7 @@ class StockImagesUpdate extends JsonApiController
}
}
private function updateResource(StockImage $resource, array $json): void
private function updateResource(StockImage $resource, array $json): StockImage
{
$updates = array_merge(
self::getAttributeUpdates($json, ['title', 'description', 'author', 'license']),
......@@ -92,5 +92,7 @@ class StockImagesUpdate extends JsonApiController
);
$resource->setData($updates);
$resource->store();
return $resource;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment