XF 2.0 Table with ID only?

CMTV

Well-known member
Hi!

I want to create a list of titles (just like trophies) which users can select. The title enitity structure consists of title_id and the title phrase. But for title I want to use MasterTitle relation so I don't need title column.

It seems I have to create a table xf_addonid_title with only one column: title_id...

Is it correct? It seems really strange to have a whole table with only one column in it...

Maybe there is a better way to do so?
 
Last edited:

DragonByte Tech

Well-known member
If you feel awkward about creating a table that only contains an ID, how about including another column for usage_count, which keeps track of how many users are using this title?

That way, you can create statistics in the ACP for showing the most popular titles, or something.


Fillip
 

alexD

Well-known member
How many records will that table have in average?
I'd use a serialized array probably stored in the registry for something small and rarely updated.
 

CMTV

Well-known member
I don't think someone would come up with more than 100 titles :)
Can you tell more about registry?
 

CMTV

Well-known member
Ok. I think you mean xf_data_registry. But what should I store there? An array of IDs? What about phrases?
 

Mike

XenForo developer
Staff member
How many records will that table have in average?
I'd use a serialized array probably stored in the registry for something small and rarely updated.
I would only do this as a cache. Generally speaking, everything in the registry should be recreatable from source data.

There's nothing wrong with creating a table with one column. You're right that in isolation, it doesn't strictly make sense. However, as you are actually using it to relate to another table, it's fine.
 
Top