Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Working with a table of dates

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

Page: 1
Go to End
Author Topic: 894 Views
  • cumquat
    Avatar
    Community Member
    189 Posts

    Working with a table of dates Link to this post

    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

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: Working with a table of dates Link to this post

    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?

  • cumquat
    Avatar
    Community Member
    189 Posts

    Re: Working with a table of dates Link to this post

    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

  • martimiz
    Avatar
    Forum Moderator
    1037 Posts

    Re: Working with a table of dates Link to this post

    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...

  • cumquat
    Avatar
    Community Member
    189 Posts

    Re: Working with a table of dates Link to this post

    Hi ya,

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

    Much appreciated.

    Mick

  • cumquat
    Avatar
    Community Member
    189 Posts

    Re: Working with a table of dates Link to this post

    Yep that all worked, many thanks martimiz.

    Mick.

    894 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.