Skip to content

Commit

Permalink
fix(core) Remove some deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAnyx committed Nov 24, 2024
1 parent 550688b commit 20333ee
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 260 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"symfony/phpunit-bridge": "^6.4",
"symfony/stopwatch": "6.4.*",
"symfony/web-profiler-bundle": "6.4.*",
"zenstruck/foundry": "^1.34"
"zenstruck/foundry": "*"
},
"config": {
"allow-plugins": {
Expand Down
171 changes: 61 additions & 110 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ security:
ROLE_PREMIUM: ROLE_USER
ROLE_ADMIN: ROLE_USER

enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: "auto"
Expand All @@ -20,9 +19,9 @@ security:
property: token

firewalls:
# dev:
# pattern: ^/(_(profiler|wdt)|css|images|js)/
# security: false
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

login:
pattern: ^/api/auth/login
Expand Down
6 changes: 6 additions & 0 deletions src/EventSubscriber/ResponseSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public function onKernelResponse(ResponseEvent $event): void
$initialRequest = $event->getRequest();
$initialResponse = $event->getResponse();

// Enabled only for project routes, not symfony routes like the profiler
[$controller, $method] = explode('::', $initialRequest->attributes->get('_controller'));
if (!class_exists($controller) || !method_exists($controller, $method)) {
return;
}

$acceptHeaders = $initialRequest->getAcceptableContentTypes();
$format = $this->getResponseFormat($acceptHeaders) ?? ContentType::JSON_STD;
$encoder = $this->getEncoder($format);
Expand Down
Loading

0 comments on commit 20333ee

Please sign in to comment.