Skip to content
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

Fix: ViewerController #379

Merged
merged 10 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/Controller/ViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
use DH\Auditor\Provider\Doctrine\Persistence\Schema\SchemaManager;
use DH\Auditor\Provider\Doctrine\Service\AuditingService;
use DH\AuditorBundle\Helper\UrlHelper;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
* @see \DH\AuditorBundle\Tests\Controller\ViewerControllerTest
*/
class ViewerController extends AbstractController
class ViewerController
{
private $environment;

Expand Down Expand Up @@ -53,7 +52,7 @@ static function ($entity) use ($reader, $scope) {
);
}

return $this->render('@DHAuditor/Audit/audits.html.twig', [
return $this->renderView('@DHAuditor/Audit/audits.html.twig', [
'audited' => $audited,
'reader' => $reader,
]);
Expand All @@ -66,7 +65,7 @@ public function showTransactionAction(Reader $reader, string $hash): Response
{
$audits = $reader->getAuditsByTransactionHash($hash);

return $this->render('@DHAuditor/Audit/transaction.html.twig', [
return $this->renderView('@DHAuditor/Audit/transaction.html.twig', [
'hash' => $hash,
'audits' => $audits,
]);
Expand Down Expand Up @@ -98,15 +97,15 @@ public function showEntityHistoryAction(Request $request, Reader $reader, string
throw $this->createAccessDeniedException();
}

return $this->render('@DHAuditor/Audit/entity_history.html.twig', [
return $this->renderView('@DHAuditor/Audit/entity_history.html.twig', [
'id' => $id,
'entity' => $entity,
'paginator' => $pager,
]);
}

protected function renderView(string $view, array $parameters = []): string
protected function renderView(string $view, array $parameters = []): Response
OskarStark marked this conversation as resolved.
Show resolved Hide resolved
{
return $this->environment->render($view, $parameters);
return new Response ($this->environment->render($view, $parameters));
}
}
2 changes: 0 additions & 2 deletions src/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ services:
# Bundle related services
DH\AuditorBundle\Controller\ViewerController:
arguments: ['@twig']
calls:
- { method: setContainer, arguments: ['@service_container'] }
tags: ['controller.service_arguments']

DH\AuditorBundle\User\UserProvider:
Expand Down