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.

Customising the CMS /

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

ModelAdmin::getManagedModels(). keep getting this error


Go to End


4 Posts   2581 Views

Avatar
lxer

Community Member, 16 Posts

20 April 2009 at 11:18pm

Edited: 20/04/2009 11:47pm

I moved my site to the production server, but now the ModelAdmin stuff doesn't work, and I keep getting this error:

[User Error] ModelAdmin::getManagedModels(): You need to specify at least one DataObject subclass in protected static $managed_models. Make sure the visibility of your property is set to "protected"

but the property is already protected!
$managed_models seems to be empty.

Infact, I started from scratch again (fresh install), and did exactly as http://doc.silverstripe.com/doku.php?id=modeladmin
but I keep getting that error...
(server: php 4.16 , MySQL 5.0.45)

On my test environment everything works fine.

Avatar
Fuzz10

Community Member, 791 Posts

21 April 2009 at 12:14am

PHP4 ?

I'm surprised Silverstripe runs at all ! ;)

Avatar
lxer

Community Member, 16 Posts

21 April 2009 at 12:20am

ehm, sorry... PHP 5.16 ;)

Just tried the latest stable release, and that works fine!
so this only exist in the dailybuild versions

Avatar
Quirk

Community Member, 1 Post

16 June 2009 at 11:25pm

Hi,

I just stumbled upon the same bug. It's a bug in php's reflection API (http://bugs.php.net/bug.php?id=38132).

The keys for the managed models array get corrupt when the Object::get_static function uses the Reflection API to get the static vars of an admin class. Thus silverstripe cannot find it using the stat function and thus thinks no managed models have been specified for that admin.

We used PHP version 5.16 as well on that server. We switched to PHP version 5.2 and everything works out fine. So just upgrade and it should work fine.