Answer the question
In order to leave comments, you need to log in
How to build a data acquisition model correctly?
Good day.
There are two trite models Team Model, Team Member Model
Accordingly, you need to display Team Data + all team members.
This functionality is used several times. In order to avoid duplication, I want to put it in a separate method.
Accordingly, the question is, where is it logical and in what model to store a method for obtaining data about the entire team?
Answer the question
In order to leave comments, you need to log in
Hello.
Right now I have a pet project with a similar structure (I am making a program for recording athletes' points at competitions). The project has a "Team" model and a "Team member" model. All data is stored in a database with a one-to-many relationship.
The following logic is implemented:
1. The user can see which team the participant belongs to. Those. I can get a team by a member, but only team data (type, country, city, etc.), I don’t get information about other team members here.
2. The user can view data for the entire team. Here, the user on command receives all its data, including all participants.
I don't know the details of your application, but it's better to implement the data retrieval method in a separate class (DAO or Repository)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question