Answer the question
In order to leave comments, you need to log in
Who needs to know about reference in MVC?
Hello!
I have a user who has his own link, a link to his comments, a link to his favorites. These links need to be displayed in different parts of the application. Where should the methods that generate these links be stored?
For example, I had the idea that if I have a User object, then I need to extract links to its pages from it, but I don’t always need to get the database from the database and create a User object for the user for whom I need to display a link. It turns out that in this case I will specifically get the user from the database for the link.
There was an idea to create a certain UserUrls class that accepted the user ID at the input and contained the getCommentsUrl , getFavoritesUrl , etc. methods in the water.
Tell me how this is usually implemented, otherwise you have to manually register links in any part of the application, and then it is not convenient to change them
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question