Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Fatal error: Cannot redeclare

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

Page: 1
Go to End
Author Topic: 2330 Views
  • StuBlackett
    Avatar
    Community Member
    2 Posts

    Fatal error: Cannot redeclare Link to this post

    Hi,

    I'm just working with SS at the moment and struggling along.

    All I want to do is store an image in a Database, But I'm getting the error :

    Fatal error: Cannot redeclare CourseProfilePage::$has_one in C:\xampp\htdocs\silverstripe\mysite\code\CourseProfilePage.php on line 65

    I'm pretty much copying this word for word from the tutorial, Just tweaked it ever so slightly.

    Any ideas on what would cause this?

    My code is as follows :

       static $db = array(
          'CourseName' => 'VarChar(100)',
          'CourseDescription' => 'HTMLText',
          'CourseAddress' => 'Text',
          'Phone' => 'Text',
          'Fax' => 'Text',
          'Email' => 'Text',
          'Website' => 'Text',
          'RoadDirections' => 'HTMLText',
          'RailDirections' => 'HTMLText',
          'AdmissionPrice' => 'HTMLText',      
          'WeatherLocation' => 'Text'
       );
       static $has_one = array(
          'CoursePicture' => 'Image'
        );

    But it doesnt like the $has_one array. What would cause this?

    Thanks in advance

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Fatal error: Cannot redeclare Link to this post

    atal error: Cannot redeclare CourseProfilePage::$has_one in ...

    Would normally happen if you have 2 static $has_one arrays in the same page class. Remove the other one and you should be sorted.

    2330 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.