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.

Widgets /

Discuss SilverStripe Widgets.

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

Fatal error: Access level to WidgetArea::$has_many must be public (as in class DataObject) in /home/xxx/public_html/widgets/code/model/WidgetArea.php on line 7


Go to End


4 Posts   4150 Views

Avatar
IDOLYZ

Community Member, 40 Posts

9 April 2013 at 1:29pm

Edited: 09/04/2013 1:30pm

Hi guys,

I've installed SS version 3 and it's all working. I then installed the mobile module and userforms module and still working.

I then try and install the widget module and blog module, but when I do a dev/build I get the following error:

Fatal error: Access level to WidgetArea::$has_many must be public (as in class DataObject) in /home/xxx/public_html/widgets/code/model/WidgetArea.php on line 7

Does anyone know why this occurs and how to fix it?

Cheers,
Ben

Avatar
zivko

Community Member, 2 Posts

10 April 2013 at 1:48am

Edited: 10/04/2013 3:20am

Edit line 13 in WidgetArea.

public static $has_many = array(
"Widgets" => "Widget"
);

But the new error :

Fatal error: Access level to Widget::$defaults must be public ..etc

Then i have to edit all private static to public static and in WidgetContentControllerExtension also public static $allowed_actions.

And then build will work.

When build is done, you will notice another error :)

After playing with code few hours, look light blog widget are not update,since php visibility method are not same like in the parent class.

I have used the new version from GitHub.

So i am back to expression engine ! :)

Cheers,
Zivko

Avatar
zivko

Community Member, 2 Posts

10 April 2013 at 5:36am

Blog upload from fix :

https://github.com/silverstripe/silverstripe-blog/tree/ss3-fixes

1) Widget class edit from private to public
2) WidgetArea class edit from private to public
3) WidgetContentControllerExtension edit from private to public
4) Rename silverstripe-widgets-master to widgets

And this is solutions that work.

Hope this help.

Cheers,
Zivko

Avatar
IDOLYZ

Community Member, 40 Posts

10 April 2013 at 11:34am

Thanks for the reply zivko.

I ended up just changing any class where I received an error to public, and it seems to work. There were quite a few scripts in the blog module that needed updating also.

Cheers,
Ben