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

Edit a field in image-table from within another page or dataobject

Go to End



Community Member, 131 Posts

13 January 2010 at 3:20am

Edited: 13/01/2010 3:21am

I have the following structure:

class SomePage extends Page {
	static $has_one => array(
		'SomeImages'	=> 'SomeImage'
	static $has_many => array(
		'SomeDataObjects'	=> 'SomeDataObject'
class SomeDataObject extends DataObject {
	static $has_one => array(
		'SomePages'	=> 'SomePage',
		'SomeImages'	=> 'SomeImage'
class SomeImage extends DataObjectDecorator {
	function extraStatics() {
		return array(
			'db' => array(
				'Copyright'	=> 'Varchar(50)'

Since copyrights directly belong to one specific image, and since they should be set ideally together with uploading an image (either related to SomePage or SomeDataObject, that shouldn't matter), I would like to create a TextField in SomePage and SomeDataObject that writes and gets it's values directly to and from the Copyright db-field in SomeImage.

My question: is this possible and how...?