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.

All other Modules /

Discuss all other Modules here.

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

Gallery Module and 2.4rc1 - extraDBFields() message during /dev/build


Go to End


8 Posts   4353 Views

Avatar
phawley

Community Member, 21 Posts

24 April 2010 at 4:18am

When I try to run a /dev/build after putting the Gallery module in an installation of 2.4rc1, I receive the following message:

Notice: DataObjectDecorator::extraDBFields() is deprecated. Please use extraStatics() instead. in /[path_to_silverstripe]/sapphire/core/model/DataObjectDecorator.php on line 60

and I'm taken to the admin login screen, but I can never login in as attempting to do so just brings me back to this message and login.

I have used the Gallery module in other 2.4rc1 installs, so seems to be afoot with this in particular, and I was hoping that someone could provide some insights/hints/tips as to why this might be happening.

Thanks in advance,
Patrick Hawley

Avatar
UncleCheese

Forum Moderator, 4102 Posts

24 April 2010 at 9:48am

Try the ImageGallery module!

Avatar
Balazs

Community Member, 2 Posts

4 May 2010 at 8:59pm

Patrick,

The problem is that the GalleryFile class extends the DataObjectDecorator class, and the Gallery module is not updated for Silverstripe 2.4 RC 1. The extraDBFields() method is overriden in the GalleryFile class, but unfortunately it's deprecated in 2.4 RC 1. In 2.4 RC 1 it is suggested to use the extraStatics() method instead.

So, all you have to do is to open the GalleryFile.php file from the /code directory of the gallery module, and look after this section:

	function extraDBFields() {
		return array(
			'db' => array(
				'PopupWidth' => 'Int',
				'PopupHeight' => 'Int',
				'Embed' => 'Boolean',
				'LimitDimensions' => 'Boolean'
			)
		);
	}

Change it to the following and you're good to go:

	function extraStatics() {
		return array(
			'db' => array(
				'PopupWidth' => 'Int',
				'PopupHeight' => 'Int',
				'Embed' => 'Boolean',
				'LimitDimensions' => 'Boolean'
			)
		);
	}

Avatar
m-phil

Community Member, 37 Posts

4 May 2010 at 10:16pm

Edited: 04/05/2010 10:33pm

There is also a small bugfix for a few mysql dbs cause of the LIMIT arg in sql querys, if the first parameter is not given

The error says something like "ASC LIMIT ,30 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '30'"

It should be LIMIT 0,30...

Change at line 385 function CurrentGalleryItems():

if(isset($_REQUEST['start'])) {
$_REQUEST['start'] = (is_numeric($_REQUEST['start'])) ? $_REQUEST['start'] : 0;
}

To:

if(isset($_REQUEST['start'])) {
$_REQUEST['start'] = (is_numeric($_REQUEST['start'])) ? $_REQUEST['start'] : 0;
} else {
$_REQUEST['start'] = 0;
}

Avatar
greenpea

Community Member, 19 Posts

28 May 2010 at 10:19am

I get the same error [Notice: DataObjectDecorator::extraDBFields() is deprecated. Please use extraStatics() instead. in /[path_to_silverstripe]/sapphire/core/model/DataObjectDecorator.php on line 60]

I am unsure where the GalleryFile.php file is located, can someone help me out?

Avatar
m-phil

Community Member, 37 Posts

28 May 2010 at 5:33pm

If you have downloaded the gallery module and copied it into your silverstripe root directory it should be in the gallery folder -> "/code/GalleryFile.php"

Avatar
greenpea

Community Member, 19 Posts

30 May 2010 at 2:50pm

I don't have the Galley Module, the error occurred when I upgraded my site to the new version of silverstripe.

The only modules I have are blog, spam protection and mollom.

I can take out the offending line from DataObjectDecorator.php, but I don't think this is the best idea. Do you have any other suggestions?

Avatar
Sunnybex

Community Member, 39 Posts

19 July 2010 at 1:03am

Hi Goldie,

I also did not have the gallery module and the same problem.

After searching all /code-files I found the same text in the "share-shis"- module, changed it and now problem solved.
Hope this helps evryone else

BR

Sunnybex