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

ComplexTableField.php (line 596)


Go to End


7 Posts   978 Views

Avatar
Schippie

Community Member, 38 Posts

13 March 2013 at 3:35am

I am not sure where i am suppost to post this, but when i went through the book(Silverstripe the complete guide to CMS development) i ran into an error. The return function: public function dataObj() in ComplexTableField.php has a error.

ClassInfo::baseDataClass(Object::getCustomClass($this->ctf->sourceClass())), $tis->itemID);

Which should be $this, though i also read this is a deprecated function so i am not sure how important it is.

Avatar
swaiba

Forum Moderator, 1899 Posts

13 March 2013 at 9:28am

Hi Schippie,

Welcome to the forums!

Can you please confirm as to which exercise from the book and which version of silverstipe you are using?

Avatar
Schippie

Community Member, 38 Posts

13 March 2013 at 9:32pm

Edited: 13/03/2013 9:34pm

Its part 5.4.1 and 5.4.2 which go into detail about the ComplexTableField. When you are then returning a function with i believe it was:

function getCMSFields()
	{
		$fields = parent::getCMSFields();
		$jobsTable = new ComplexTableField(
			$this, 
			'Jobs', 
			'Job'
		);
		$fields->addFieldToTab('Root.Jobs', $jobsTable);
		return $fields;
	}

Or it was:

function getCMSFields()
	{
		$fields = new FieldList(
			new TextField('Title', 'Job Title'),
			new TextAreaField('Description', 'Job Description'),
			new TextField('Location', 'Location'),
			new DateField('ExpiryDate', 'Expiry Date')
		);
		return $fields;
	}

Though i have change new FieldSet to new FieldList (to be inline with the documentations).
And i was using silverstripe 3.0.5

Avatar
swaiba

Forum Moderator, 1899 Posts

13 March 2013 at 10:06pm

ComplexTableField has been replaced by GridField in silverstripe 3+

I think Ingo said there is a module for use of this in 3+ but it isn't in the core code anymore

Avatar
Schippie

Community Member, 38 Posts

13 March 2013 at 10:16pm

Would explain the bug in the code. What are the key differences between gridfield and complextablefield in terms of implementation?
Also in the context of the book that is. Seeing as the docs page about gridfields seems to point at the fact that a gridfield no longer is in the page extend but in the page controller extend?

Avatar
swaiba

Forum Moderator, 1899 Posts

13 March 2013 at 10:34pm

What are the key differences between gridfield and complextablefield in terms of implementation?

Too many to list here, but the changes are massive and AFAIK for the better.

Also in the context of the book that is. Seeing as the docs page about gridfields seems to point at the fact that a gridfield no longer is in the page extend but in the page controller extend?

I'm not sure what book you mean, if you mean Ingo's SS book then you'll have to use a 2.4.x version, I suggest...
http://www.silverstripe.org/assets/releases/SilverStripe-cms-v2.4.10.tar.gz

Avatar
Schippie

Community Member, 38 Posts

13 March 2013 at 10:39pm

Edited: 13/03/2013 10:41pm

Hmm , needing to use an oudated version to be inline with the book would be a bad idea. Will just have to read up through the documentation of GridFields. And see if there are examples of the implementation floating around the internet then.

http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management

will do what i need for the information part :)