Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/660-task-custom-reports-tree-lis…
Browse files Browse the repository at this point in the history
…ting-endpoint' into 660-task-custom-reports-tree-listing-endpoint
  • Loading branch information
mcop1 committed Jan 10, 2025
2 parents bc3d3da + 533c041 commit da7bae1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/CustomReport/Controller/GetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace Pimcore\Bundle\StudioBackendBundle\CustomReport\Controller;

use Exception;
use OpenApi\Attributes\Get;
use OpenApi\Attributes\JsonContent;
use Pimcore\Bundle\StudioBackendBundle\Asset\OpenApi\Attribute\Parameter\Path\NameParameter;
Expand Down Expand Up @@ -54,7 +55,7 @@ public function __construct(

/**
* @throws NotFoundException|DatabaseException
* @throws \Exception
* @throws Exception
*/
#[Route('/custom-reports/{name}',
name: 'pimcore_studio_api_custom_report_get',
Expand Down Expand Up @@ -90,9 +91,10 @@ public function __construct(
public function getByName(string $name): JsonResponse
{
$config = $this->customReportService->getCustomReportByName($name);
if(!$config) {
if (!$config) {
throw new NotFoundException('Custom report', $name, 'name');
}

return $this->jsonResponse(
$this->customReportHydrator->hydrateCustomReportDetails($config)
);
Expand Down
5 changes: 3 additions & 2 deletions src/CustomReport/Hydrator/CustomReportHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ public function hydrateCustomReportConfigTree(array $reports): array
return $hydratedReports;
}

public function hydrateCustomReportDetails(Config $reportConfig): array {
public function hydrateCustomReportDetails(Config $reportConfig): array
{
return [
... $reportConfig->getObjectVars(),
'writeable' => $reportConfig->isWriteable()
'writeable' => $reportConfig->isWriteable(),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ interface CustomReportHydratorInterface
public function hydrateCustomReportTree(array $reports): array;

public function hydrateCustomReportConfigTree(array $reports): array;

public function hydrateCustomReportDetails(Config $reportConfig): array;
}

0 comments on commit da7bae1

Please sign in to comment.