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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Error


Go to End


2 Posts   2150 Views

Avatar
RobboNoCash

Community Member, 33 Posts

12 August 2015 at 2:06pm

Hi I have got a error in this code.
I don't know what the error is.
But if someone can take a look and see what the error is, and let me know that would be great.

Thanks

<?php
class Services extends Page {

public static $has_many = array(
'Servo' => 'ServicePart'
);

public function getCMSFields() {

$f = parent::getCMSFields();

$config = GridFieldConfig_RecordEditor::create();

//$config = GridFieldConfig_RelationEditor::create();

$servicetext = new GridField("Servo", "Servo", $this->Servo(), $config);
$f->addFieldToTab('Root.Events', $servicetext);
// $f->addFieldToTab('Root.Main', new TextField('Head'), 'Content');

return $f;

}

}

class Services_Controller extends Page_Controller {

public function init() {
parent::init();
}

}

<?php
class ServicePart extends DataObject {

public static $db = array(
'HeadingService' => 'Text',
'DescriptionText' => 'Text'
);

public static $has_one = array(
'Page' => 'Page',
'Image' => 'Image'
);

public function getCMSFields() {
$f = new FieldList();

$f->push( new TextField('HeadingService', 'Heading for service') );
$f->push( new TextField('DescriptionText', 'Description for service') );

return $f;
}
}
?>

Avatar
Pyromanik

Community Member, 419 Posts

12 August 2015 at 10:22pm

If you're using v3.1, they need to be private static.
never ?> on pure PHP files.