Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Working with a table of dates


Reply

6 Posts   968 Views

Avatar
cumquat

8 April 2011 at 7:50pm Community Member, 198 Posts

Hi there,

I was hoping someone could point me in the right direction or at the very least give me a shove, i have a number of tables on a site that would benefit from having a separate date table, eg, i have a table of skills associated with the member table on a belongs_many_may relationship some of these skills will have an expiry date, i also have a table of dogs who have a level that needs a start date and an expiry date, can i just create a single table with dates from and dates to fields and link that in to all the relevant tables? Is that the right way forward?

Hope you can help

Mick

Avatar
martimiz

8 April 2011 at 11:27pm Forum Moderator, 1095 Posts

If at all possible, I would go for adding the datefields to the tables themselves (dogs, skills) themselves. Unless you have very good reasons, because this will make things complicated. I'm assuming skill expiry dates and dog level start dates don't really have much in common beside being dates?

Avatar
cumquat

9 April 2011 at 12:14am Community Member, 198 Posts

Hi ya,

yea the dates aren't related and i was thinking of having the dates on the tables themselves but with the skills list each person is gonna have a set of skills, First Aid, Radio etc and each of those will have a different date for each skill and member so kinda leads me to think they need to be a separate table but not sure how to join the whole lot up.

I think this may have to be a just a date table for the team skills but will need to think about this a bit more.

Cheers

Mick

Avatar
martimiz

9 April 2011 at 3:54am Forum Moderator, 1095 Posts

so maybe:

each Member has-many Skills
each Skill has_one SkillType and has_one Member
each SkillType has_many Skills

so you'd have
- a Skill object, that holds all info concerning a SkillType for a certain member - including dates and stuff and what SkillType it refers to
- a general SkillType object with records for First Aid, Radio and what have you, and maybe some descriptions,

I wouldn't mix that up with date-related dog-level-stuff, but create whole new Object types for that - room enough... :-)

Avatar
cumquat

11 April 2011 at 9:07pm Community Member, 198 Posts

Hi ya,

Thanks for the reply i shall look at that and see how i do.

Much appreciated.

Mick

Avatar
cumquat

11 April 2011 at 11:04pm Community Member, 198 Posts

Yep that all worked, many thanks martimiz.

Mick.