-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partical Cache and sortColumn update #35
Comments
I could do this on has_many relationships and it did when I was using DataObject::write(). But for efficiency I switched to plain sql never thought to update the LastEdit date but it makes complete sense especially given the case your suggesting. |
Hey cool! thx for the quick improvement! |
After updating to the latest version I got an error, related to the lastEdited-field on some of my DataObjects. ERROR [User Error]: Couldn't run query: UPDATE "Section" SET "Priority" = 1,"LastEdited"='2013-05-25 16:13:35'WHERE "ID" = 23 Unknown column 'LastEdited' in 'field list'IN POST /admin/sections/Section/EditForm/field/SectionLine 592 in /framework/model/MySQLDatabase.phpSource====== 583: } 584: 585: public function databaseError($msg, $errorLevel = E_USER_ERROR) { 586: // try to extract and format query 587: if(preg_match('/Couldn't run query: ([^|])|\s(.)/', $msg, $matches)) { 588: $formatter = new SQLFormatter(); 589: $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2]; 590: } 591: * 592: user_error($msg, $errorLevel); 593: } 594: 595: /* 596: * Return a boolean type-formatted string 597: * 598: * @param array $values Contains a tokenised list of info about this data typeTrace=====user_error(Couldn't run query: UPDATE "Section" SET "Priority" = 1,"LastEdited"='2013-05-25 16:13:35'WHERE "ID" = 23 Unknown column 'LastEdited' in 'field list',256)MySQLDatabase.php:592MySQLDatabase->databaseError(Couldn't run query: UPDATE "Section" SET "Priority" = 1,"LastEdited"='2013-05-25 16:13:35' WHERE "ID" = 23 | Unknown column 'LastEdited' in 'field list',256)MySQLDatabase.php:144MySQLDatabase->query(UPDATE "Section" SET "Priority" = 1,"LastEdited"='2013-05-25 16:13:35' WHERE "ID" = 23,256)DB.php:200DB::query(UPDATE "Section" SET "Priority" = 1,"LastEdited"='2013-05-25 16:13:35' WHERE "ID" = 23)GridFieldSortableRows.php:332GridFieldSortableRows->saveGridRowSort(GridField,Array)GridFieldSortableRows.php:245GridFieldSortableRows->handleAction(GridField,savegridrowsort,Array,Array)GridField.php:674GridField->handleAlterAction(saveGridRowSort,Array,Array)GridField.php:636GridField->gridFieldAlterAction(Array,Form,SS_HTTPRequest)GridField.php:108GridField->index(SS_HTTPRequest)RequestHandler.php:278RequestHandler->handleAction(SS_HTTPRequest,index)RequestHandler.php:190RequestHandler->handleRequest(SS_HTTPRequest,DataModel)GridField.php:749 My tables look like this:
hope that helps ;) |
Right... because I forgot to take into account the sort column can be on a decedent of the base object. I'll do up a change to address this. |
Should be good to go now |
Hey,
I just saw that
GridFieldSortableRows
uses plain SQL to update the sortColumn which makes it a bit difficult to use it with the partical cache and aggregates like<% cached 'sortablelist', List(SortableObject).max(LastEdited) %>
.As the sortColumn doesn't reflect a relation
lastEdited
should be updated.What do you think?
The text was updated successfully, but these errors were encountered: