Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Define RoutesResponse as a Service #474

Merged

Conversation

pyksid
Copy link
Contributor

@pyksid pyksid commented Dec 14, 2023

Define Response\RoutesResponse as a Service allows to override and decorate it, to modify the returned routes for the specific needs of its web app.

It allows then to modify the getRoutes() function with a Decorator for example:

<?php

namespace App\Decorator;

use FOS\JsRoutingBundle\Response\RoutesResponse;
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;

#[AsDecorator(decorates: 'fos_js_routing.routes_response')]
class RoutesResponseDecorator extends RoutesResponse
{
    public function getRoutes(): array
    {
        [...]
    }

@pyksid pyksid force-pushed the feature-routesresponse-as-a-service branch from aeb9ea5 to 012e29d Compare December 14, 2023 14:02
@tobias-93 tobias-93 merged commit 8aaf3ae into FriendsOfSymfony:master Jan 23, 2024
10 checks passed
@tobias-93
Copy link
Collaborator

Thanks @pyksid

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants