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

Add form field datetime with many_many table


Go to End


1024 Views

Avatar
khanhdeux

Community Member, 13 Posts

19 December 2013 at 4:55am

Hi team,
i have the following dataobjects

class Video extends DataObject {

private static $belongs_many_many = array(
'Channels' => 'Channel',
);

);

class Channel extends DataObject {

private static $db = array(
'ChannelTitle' => 'Varchar(255)',
'ChannelDescription' => 'Text'
);
private static $many_many = array(
'Videos' => 'Video'
);
private static $summary_fields = array(
'ChannelTitle'
);
private static $many_many_extraFields = array(
'Videos' => array(
'PublishedDate' => 'SS_Datetime',
'UnpublishedDate' => 'SS_Datetime'
)
);

}
The relation between video and channel is many_many
now i have to add a form to submit the publishedDate and unpublisheddate for the specific channels. what is the datefields and variable suitable name for its like i have Channel: youtube, smarttv, tablets.. and add 2 above fields to set to each channel for a video. Thanks