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.

Data Model Questions /

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

has_many Files and AssetTableField


Go to End
Reply


3 Posts   1715 Views

Avatar
netnoise

Community Member, 10 Posts

2 March 2010 at 12:09am

Hi!

I am trying to use the AssetTableField for linking multiple files to a page, but the selection in AssetTableField does not get saved. Did I miss some point? Any hint is highly appreciated.

Thanks!

<?php

class ContentPage extends Page {
	
	// database relations
	public static $db = array(
	);
	
	public static $has_one = array(
	);
	
	public static $has_many = array(
		'Files' => 'File'
	);	

	// fields in CMS
	function getCMSFields() {
		$fields = parent::getCMSFields();
		$downloadsTable = new AssetTableField(
			$this,
			'Files',
			'File',
			array(
				'Title' => 'Bezeichnung',
				'Filename' => 'Dateiname'
			)
		);
			
		$fields->addFieldToTab('Root.Content.Downloads', $downloadsTable);
		
		return $fields;
	}   
	
}
?>

Avatar
johannes

Community Member, 20 Posts

11 April 2010 at 5:04am

Same problem here, can't anybody help with this?

Avatar
timcole

Community Member, 32 Posts

23 April 2010 at 2:16am

I my experience the DataObjectManager module (which includes FileObjectManager) is generally an easier and nicer way to do these sorts of things. Take a look on the modules page for it - there are some good tutorials and a specific area on the forum.