XF 2.2 Store an object or array in table.field

Robert9

Well-known member
I get an object with ->fetch('team_id');
or
an array with ->fetchRaw('team_id');

the data will be 18 integers and i have no idea how to save them.

Which type of field should i choose, please, and why?
And what do i fetch (object/array) and how to prepare it?


Should i save only the ids and fetch the names later?
Or better save ids and names to have some queries less later?

1, green
2, red
3, blue
...
 
The better option would be to save the ids, as at the of the day these are unique values and labels/names could be change anytime.
 
Yes and now. Here is the flow:

Server1 sends data to server2;
leagues
teams
matches

to send the data which team are in a league, the table "league" has a data field with "teams_ids";
after importing a league a rebuild adds this data to a new table

league_teams with
league_id, team_id
 
@Robert9 looks good to me but here is a question why not you are storing directly into league_teams and wait for the rebuild to do that?
there will be a bulk of data that makes the request heavy for sending from server1 to server2 ?
 
Finally i dont know it.
I have watched another script to understand, how they have done it.
My tables are somehow not the same, but this field/the idea i have overtaken.
And somehow the info: "teams of a league" is a part of the info "league".

The data is now "1,2,3,4,5,"

Without that it would be "league_server_id, 1,2,3,4,5"; there is no difference, but one more fetch.
Probably i will have a list of leagues to fetch first:
Then offering to fetch: teams; then matches.

The matches are also a part of "league", but here we have more data to send; i will see it, when i am there, how to solve it.

The whole project is there to learn xf; so it is not the worst to have now the need of job and a rebuild.
So i will try this now to program.
 
Back
Top Bottom