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.

Widgets

Discuss SilverStripe Widgets.

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

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


Reply

4 Posts   1812 Views

Avatar
IDOLYZ

9 April 2013 at 1:29pm (Last edited: 9 April 2013 1:30pm), Community Member, 40 Posts

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

10 April 2013 at 1:48am (Last edited: 10 April 2013 3:20am), Community Member, 2 Posts

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

10 April 2013 at 5:36am Community Member, 2 Posts

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

10 April 2013 at 11:34am Community Member, 40 Posts

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