Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved how the last edit table is found using ClassInfo::baseDataCl…

…ass()
  • Loading branch information...
commit fc2d17ace5d2dd818947b9d61fbc96ce31e6d4ea 1 parent a44c66d
@UndefinedOffset authored
Showing with 2 additions and 14 deletions.
  1. +2 −14 code/forms/GridFieldSortableRows.php
View
16 code/forms/GridFieldSortableRows.php
@@ -183,12 +183,6 @@ protected function fixSortColumn($gridField, SS_List $dataList) {
user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
exit;
}
-
- //Find table containing the last edited column
- $lastEditTable=false;
- $class=$gridField->getModelClass();
- $classes=array_keys(ClassInfo::ancestry($class, true));
- $lastEditTable=$classes[0];
}
@@ -208,7 +202,7 @@ protected function fixSortColumn($gridField, SS_List $dataList) {
. '" SET "' . $sortColumn . '" = ' . ($max + $i)
. ' WHERE "ID" = '. $obj->ID);
- DB::query('UPDATE "' . $lastEditTable
+ DB::query('UPDATE "' . ClassInfo::baseDataClass($gridField->getModelClass())
. '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\''
. ' WHERE "ID" = '. $obj->ID);
}
@@ -318,12 +312,6 @@ protected function saveGridRowSort(GridField $gridField, $data) {
user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
exit;
}
-
- //Find table containing the last edited column
- $lastEditTable=false;
- $class=$gridField->getModelClass();
- $classes=array_keys(ClassInfo::ancestry($class, true));
- $lastEditTable=$classes[0];
}
@@ -345,7 +333,7 @@ protected function saveGridRowSort(GridField $gridField, $data) {
. '" SET "' . $sortColumn . '" = ' . (($sort + 1) + $pageOffset)
. ' WHERE "ID" = '. $id);
- DB::query('UPDATE "' . $lastEditTable
+ DB::query('UPDATE "' . ClassInfo::baseDataClass($gridField->getModelClass())
. '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\''
. ' WHERE "ID" = '. $id);
}
Please sign in to comment.
Something went wrong with that request. Please try again.