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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Sortable Data Object Not Working?


Go to End


3 Posts   2032 Views

Avatar
DanStephenson

Community Member, 116 Posts

12 May 2009 at 2:36pm

Edited: 12/05/2009 2:56pm

I am trying to make my dataobject called Models sortable. When I add the following code to my _config.php file:

SortableDataObject::add_sortable_class('Model');

Then I do a /dev/build/, I am taken to an admin login where I put in the username and password, but it never lets me login. Any idea what could be wrong?

Avatar
DanStephenson

Community Member, 116 Posts

12 May 2009 at 4:28pm

Edited: 12/05/2009 4:57pm

I am now getting an error message that there is a problem with the output at Line 1 of Model.php. I've pasted my code below, if anyone can see what's wrong.

<?php
class Model extends DataObject {
	static $db = array (
		'ModelName' => 'Text',
		'ModelLink' => 'Text'
	);
	
	static $has_one = array (
		'BrandPage' => 'BrandPage'
	);
	
	public function getCMSFields_forPopup()
	{
		return new FieldSet(
			new TextField('ModelName'),
			new TextField('ModelLink')
		);
	}
	
	function Second(){
		return $this->iteratorPos % 2;
	}
}
?>

Avatar
UncleCheese

Forum Moderator, 4102 Posts

13 May 2009 at 1:52am

This is just a guess, but I'll bet Model is a reserved classname.