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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

CustomSiteConfig should be compatible with DataExtension::extraStatics()


Reply


3 Posts   1617 Views

Avatar
priithansen

Community Member, 25 Posts

21 June 2012 at 8:29am

I'm getting this line in my php log on every page load

PHP Strict Standards: Declaration of CustomSiteConfig::extraStatics() should be compatible with that of DataExtension::extraStatics() in /ss3/mysite/code/CustomSiteConfig.php on line 17

CustomSiteConfig.php files content

<?php

class CustomSiteConfig extends DataExtension {

   public function extraStatics(){
   return array(
   'db' => array(
      'FacebookLink' => 'Varchar(255)'
         )
      );
   }

   public function updateCMSFields(FieldList $fields) {
      $fields->addFieldToTab('Root.Main', new TextField('FacebookLink', 'Facebook Link'));
      $fields->removeByName('Theme');
   }
}

Using SS3 RC1 wiht MAMP and php version 5.3.6

Any ideas what could be wrong with my code?

Avatar
simon_w

Forum Moderator, 474 Posts

21 June 2012 at 10:31am

Edited: 21/06/2012 10:32am

The [url=http://doc.silverstripe.org/framework/en/3.0/changelogs/3.0.0#extensions]upgrading documentation[/url] explains that extraStatics() is deprecated and you should just use

public static $db = array(
   'FacebookLink' => 'Varchar(255)',
);

The error itself is because 3.0 now includes E_STRICT errors, so method declarations must match the declaration of the parent method it is overriding.

Avatar
priithansen

Community Member, 25 Posts

21 June 2012 at 10:54am

Thank You for the help, don't know how I missed that.