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

FOSRest\View group overload when forwarding to controller #2335

Open
flohw opened this issue Sep 30, 2021 · 0 comments
Open

FOSRest\View group overload when forwarding to controller #2335

flohw opened this issue Sep 30, 2021 · 0 comments

Comments

@flohw
Copy link
Contributor

flohw commented Sep 30, 2021

Hi!

I notice that when a controller forward its request to another the @FOSRest\View annotation is overloaded by the latest instead of the annotation on the controller which forward the request. I think the good option would be that the forwarding controller should override the latest.

An example to clarify

namespace Backend\Controller;

/**
 * @FOSRest\View(serializerGroups={"backend_list"})
 */
class GetNewsController {
    public function __invoke() {
        return $this->forward(Frontend\Controller\GetNewsController::class);
    }
}

namespace Frontend\Controller;

/**
 * @FOSRest\View(serializerGroups={"frontend_list"})
 */
class GetNewsController {
    public function __invoke() {
        return [];
    }
}

When the Frontend controller is called, the applied serializer groups are those one listed in Backend. Which might be a problem.

I can try to investigate and make a PR if I can get some clues where to search 🙂

Thanks

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

No branches or pull requests

1 participant