我在为特定页面类型创建任何表时遇到问题,无论是使用该页面类型中断添加$db
还是$has_one
所有页面...我都不明白发生了什么或者如何解决它。
这是我正在使用的模型
Content.php
class Content extends Page {
private static $db = array(
'TranslatedTitle' => 'Varchar(255)',
'TranslatedContent' => 'HTMLText'
);
public function getCMSFields(){
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Content.Translation', array(
TextField::create('TranslatedTitle'),
HTMLEditorField::create('TranslatedContent')
)
);
return $fields;
}
}
class Content_Controller extends Page_Controller {}
这是出现的错误,
我把它分开了一点,所以它是可读的
[08-Sep-2016 10:07:00] Error at framework/model/connect/DBConnector.php line 55:
Uncaught SS_DatabaseException: Couldn't run query:
SELECT DISTINCT
"SiteTree_versions"."ClassName",
"SiteTree_versions"."LastEdited",
"SiteTree_versions"."Created",
"SiteTree_versions"."URLSegment",
"SiteTree_versions"."Title",
"SiteTree_versions"."MenuTitle",
"SiteTree_versions"."Content_versions",
"SiteTree_versions"."MetaDescription",
"SiteTree_versions"."ExtraMeta",
"SiteTree_versions"."ShowInMenus",
"SiteTree_versions"."ShowInSearch",
"SiteTree_versions"."Sort",
"SiteTree_versions"."HasBrokenFile",
"SiteTree_versions"."HasBrokenLink",
"SiteTree_versions"."ReportClass",
"SiteTree_versions"."CanViewType",
"SiteTree_versions"."CanEditType",
"SiteTree_versions"."Version",
"SiteTree_versions"."ParentID",
"Page_versions"."SiteID",
"Content_versions"."TranslatedTitle",
"Content_versions"."TranslatedContent",
"SiteTree_versions"."ID",
CASE WHEN
"SiteTree_versions"."ClassName"
IS NOT NULL THEN
"SiteTree_versions"."ClassName"
ELSE
'SiteTree'
END AS
"RecordClassName",
"SiteTree_versions"."RecordID",
"SiteTree_versions"."WasPublished",
"SiteTree_versions"."AuthorID",
"SiteTree_versions"."PublisherID"
FROM
"SiteTree_versions"
LEFT JOIN
"Page_versions"
ON
"Page_versions"."ID" = "SiteTree_versions"."ID"
LEFT JOIN
"Content_versions"
ON
"Content_versions"."ID" = "SiteTree_versions"."ID"
WHERE ("SiteTree_versions"."ClassName" IN (?))
AND ("SiteTree_versions"."RecordID" = ?)
ORDER BY
"SiteTree_versions"."LastEdited" DESC,
"SiteTree_versions"."Version" DESC
42S22-1054: Unknown column 'SiteTree_versions.Content_versions' in 'field list'
我在任何其他页面类型上都没有这个...为什么会发生这种情况?