Relations between Models

Dear Enyo crowd,

still trying to make sense of the 2.3 changes :)

I'm really happy with how Models, Controllers and DataRepeaters interact. However, I haven't figured out yet how to best model relations between models. My use-case is that I would like to populate a Collection of locations at application start time. Each of these locations contains a list of sessions (think of a sports course in a fitness club). I would like to model the sessions as a Model of its own, so that I can add observers to them (changes in the sessions shall modify properties in the location). What's the best way to do that?

If I make a top-level Collection for sessions, how do the locations link to their sessions? ATM, sessions do not have a primary key.

I think I'd prefer"session") returns a Collection again of all sessions of that location. Is that a sensible approach? Or is it a stupid idea to create maybe 100 collections, all holding different instances of the same model?

You can see that data structure here:

Thanks for your support!


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!