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

Error when building database


Reply


3 Posts   381 Views

Avatar
ranjitendurthi

Community Member, 2 Posts

27 October 2011 at 5:06pm

Can anyone tell me the error in the below script

I am getting the error ( ! ) Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\SilverStripe-v2.4.5\SilverStripe-v2.4.5\mysite\code\Fixture.php on line 26 when I build the database

Line 26 is $fields->addFieldToTab( 'Root.Content.Teams', $tablefield );

<?php

class Fixture extends Page {

static $has_one = array(
'MyTeam' => 'Team'
);
   function getCMSFields() {
$fields = parent::getCMSFields();

$tablefield = new HasOneComplexTableField(
$this,
'MyTeam',
'Team',
array(
'TeamName' => 'TeamName',
'Country' => 'Country',
'Captain' => 'Captain'
),
'getCMSFields_forPopup'
);
$tablefield->setParentClass('Fixture');
              

$fields->addFieldToTab( 'Root.Content.Teams', $tablefield );

return $fields;
}

}
class Project_Controller extends Page_Controller {}

Cheers
Ranjit

Avatar
martimiz

Forum Moderator, 1105 Posts

28 October 2011 at 7:58am

Edited: 28/10/2011 7:59am

Hi Ranjit,

Welcome to the forums,

I don't see anything wrong with your code, and it builds fine on my testinstall...

Happy SilverStriping :-)

Avatar
ranjitendurthi

Community Member, 2 Posts

28 October 2011 at 10:09am

Thanks for the reply
It showed error few times but when I tried to rebuild the database after restarting the server it worked fine

Thanks anyway

cheers
Ranjit