Commit 1ecffc35 authored by Dries's avatar Dries
Browse files

- Patch #566940 by catch: move node specific code out of entity.inc.

parent 34036dba
......@@ -188,14 +188,6 @@ protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE)
// The id field is provided by entity, so remove it.
unset($entity_revision_fields[$this->idKey]);
// Change timestamp to revision_timestamp, and revision uid to
// revision_uid before adding them to the query.
// TODO: This is node specific and has to be moved into NodeController.
unset($entity_revision_fields['timestamp']);
$query->addField('revision', 'timestamp', 'revision_timestamp');
unset($entity_revision_fields['uid']);
$query->addField('revision', 'uid', 'revision_uid');
// Remove all fields from the base table that are also fields by the same
// name in the revision table.
$entity_field_keys = array_flip($entity_fields);
......
......@@ -3651,4 +3651,16 @@ protected function attachLoad(&$nodes, $revision_id = FALSE) {
$this->hookLoadArguments[] = array_keys($typed_nodes);
parent::attachLoad($nodes, $revision_id);
}
protected function buildQuery($ids, $conditions, $revision_id) {
// Ensure that uid is taken from the {node} table,
// alias timestamp to revision_timestamp and add revision_uid.
$query = parent::buildQuery($ids, $conditions, $revision_id);
$fields =& $query->getFields();
unset($fields['timestamp']);
$query->addField('revision', 'timestamp', 'revision_timestamp');
$fields['uid']['table'] = 'base';
$query->addField('revision', 'uid', 'revision_uid');
return $query;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment