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

*** Solved *** 2.4.9 ImageDataObjectManage


Go to End
Reply


2 Posts   415 Views

Avatar
Johan

Community Member, 49 Posts

15 February 2013 at 12:28am

Edited: 15/02/2013 12:32am

Hi

ImageDataObjectManage used to work on other sites, but on a new site using 2.4.9 and the same dataobject manager adding this code generates an error in the CMS

		$fields->addFieldToTab('Root.Content.Images', new ImageDataObjectManager(
				$this,
				'Photos',
				'Photo',
				'Image',
				array('Title'=>'Title', 'Image'=>'Image')
			)
		);

Obviousely I have:

	static $has_many = array(
		'Photos'=>'Photo'
	);
	

Is there a workaround?

Avatar
Johan

Community Member, 49 Posts

15 February 2013 at 1:01am

I needed to add the data object for my gallery photos

<?php

class Photo extends DataObject {
	static $db = array(
		'Title' => 'Varchar(128)'
	);
	
	static $has_one = array(
		'Image'=>'Image',
		'ParentPage'=>'Page'
	);
}