Mam dwa obiekty Schedule
i LocationPage
. Obiekt Schedule
ma $has_one
stosunku do LocationPage
:Sortowanie SilverStripe według pola relacji has_one "title"
class Schedule extends DataObject {
private static $db = array(
'Date' => 'Date',
);
private static $has_one = array(
'Location' => 'LocationPage',
);
}
i
class LocationPage extends Page {
private static $db = [
'Heading' => 'HTMLVarchar(250)',
'SubHeading' => 'Varchar(250)'
];
}
Kiedy próbuję sortować według pola relacji Title
wyskakuje mi błąd. Oto kod sortowania:
Schedule::get()->sort(['Location.Title' => 'ASC']);
tu jest błąd, że mam porządek podczas wywoływania powyższy kod:
[Błąd użytkownika] Uncaught SS_DatabaseException: Nie można uruchomić zapytanie: select distinct „Harmonogram "ClassName", "Schedule". "LastEdited", "Schedule". "Created", "Schedule". "Date", "Schedule". "LocationID", "Schedule". "ID", CASE WHEN "Schedule "ClassName" NIE JEST NIŻE THEN "Schedule". "ClassName" ELSE "Schedule" END AS "RecordClassName", "LocationPage". "Tytuł" AS "_SortColumn0" FROM "Schedule" LEFT JOIN "LocationPage" ON "LocationPage" "ID" = "Harmonogram". "LocationID" INNER JOIN "Strona" ON "LocationPage". "ID" = "Strona". "ID" INNER Join "SiteTree" ON "LocationPage". "ID" = "SiteTree". "ID" ORDER BY "_SortColumn0" ASC Nieznanego kolumnie 'LocationPage.Title' w polu '' listy
Co jest przyczyną tego problemu?
To szwy, że to błąd Silverstripe. Otworzyłem ten problem. Mam nadzieję, że to naprawili. –
Problem, dla odniesienia: https://github.com/silverstripe/silverstripe-framework/issues/7029 –