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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Working with a table of dates


Go to End


6 Posts   1305 Views

Avatar
cumquat

Community Member, 201 Posts

8 April 2011 at 7:50pm

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

Forum Moderator, 1391 Posts

8 April 2011 at 11:27pm

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

Community Member, 201 Posts

9 April 2011 at 12:14am

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

Forum Moderator, 1391 Posts

9 April 2011 at 3:54am

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

Community Member, 201 Posts

11 April 2011 at 9:07pm

Hi ya,

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

Much appreciated.

Mick

Avatar
cumquat

Community Member, 201 Posts

11 April 2011 at 11:04pm

Yep that all worked, many thanks martimiz.

Mick.