Answer the question
In order to leave comments, you need to log in
How to bypass code duplication in Symfony2 controller?
Hello.
The question is next. There are links to access resources. Resources have a certain hierarchy, for example, the link will look like this:
/cart/{cartId}/product/{productId}
Answer the question
In order to leave comments, you need to log in
There were thoughts to put everything in a regular manager, but I don’t think that throwing HTTPExceptions by a manager is a good idea.
Your checks can be put in annotations.
To check if an entity with the desired id exists, you can use the @ParamConverter
annotation.
To check access rights, you can use @Security.
All exceptions will be thrown automatically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question