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

Add form field datetime with many_many table


Reply


339 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