CakePHP Model Design Advice: Associating a RDBMS model with an extensible/hierarchical model (JSON/XML/Array) -


before continue reading
i'm seeking advice on data modelling strategy against implementation (though touch on @ end bit)—i know how i'm describing, i'm not confident ways of doing aren't fool's errands.

the problem

broadly, have model (call game actual context pretty esoteric) properties of known structure & size (title,player_id, etc.). except 1 property, game_template, warrants model itself, hierarchical one—i'm using json, xml, whatever. importantly, not need querygame_template; always required all-or-none, property of game model except when being manipulated in context of it's parent instance of game.

do need 2 models?
though every game–game_template relationship have-and-belongs-to-one, templates should share methods , have common required fields (ie. params property, of there may 0–n params, each having 0–n of fields of variety of types)

where become unsure how link these inside cake effectively.

the 2 solutions i'm considering (though i'm open any)

1) using "extracted" data 1 model object create other
include json text column on database, ie. games.game_template. when game record instantiated controller, have instantiate game template model parsing raw text (ie. json_decode('game_template', true)) , passing result array datasource model it?

2) keep data in separate file , use model associations
keep .json files somewhere locally (say lib/game_templates/<id>.json) , associate id parent model vis-a-vis cakephp convention (ie. game_template_id field of game? intuitively can think of reasons go either way. if is appropriate solution, though, i've no idea if cakephp can handle associations between totally different data sources or if there beyond i've described i'd need do.

are sure right forum question? question involves json, text on column on database, instantiation of model, parsing raw text, passing results, arrays, store files, etc.

i think none of these subjects relevant data modeling. me design or implementation-related.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -