我在 Silverstripe 4 上有两个 DataObjects。首先是一个测验,其中包含一个 has_many-relationships 与该测验的问题。
use SilverStripe\ORM\DataObject;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\CheckboxField;
class Quiz extends DataObject {
private static $db = [
"Name" => "Varchar(200)",
"bis" => "Date()",
"aktiv" => "Boolean",
"Mail" => "Boolean",
"MailText" => "Text"
];
private static $has_one = [
];
private static $has_many = [
"Fragen" => Quiz_Fragen::class
];
问题的代码。
use SilverStripe\ORM\DataObject;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TextareaField;
class Quiz_Fragen extends DataObject {
private static $db = [
"Frage" => "HTMLText",
"Art" => "Enum(array('auswählen','MC','Text','Check'))",
"OP1" => "Varchar(400)",
"OP2" => "Varchar(400)",
"OP3" => "Varchar(400)",
"OP4" => "Varchar(400)",
"Foul" => "Varchar(50)",
"Team" => "Enum(array('A','B'))",
"Punkte" => "Varchar(200)",
"Down" => "Enum(array('1','2','3','4','Try','FK'))",
"Pos" => "Varchar(25)",
"Distanz" => "Varchar(2)",
"Uhr" => "Enum(array('Snap','Ballfreigabe','Down ohne Zeit','keine','läuft'))",
"Sonstiges" => "Varchar(50)",
"Antwort" => "HTMLText",
"SortOrder" => "Int",
"Grund" => "HTMLText",
"Pkt" =>"Enum(array('1','2','3','4','5','6','7','8','9','10','11','12'))"
];
private static $has_one = [
"Quiz" => Quiz::class
];
private static $has_many = [
];
在 Silverstripe 3 中,我选择了一个数据对象测验条目,顶部有一个链接,可以查看与所选测验相关的问题。我错过了 Silverstripe 4 中的这个链接。我确定我只是错过了一些小东西。但我找不到解决方案。