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

*** Solved *** 2.4.9 ImageDataObjectManage


Go to End


2 Posts   1021 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'
	);
}