summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/comment.module20
-rw-r--r--modules/node/node.module5
-rw-r--r--modules/taxonomy/taxonomy.module53
-rw-r--r--modules/user/user.module5
4 files changed, 36 insertions, 47 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index a150d2188..f72fad9ca 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1602,17 +1602,19 @@ function comment_load($cid) {
* special handling for comment objects.
*/
class CommentController extends DrupalDefaultEntityController {
- protected function buildQuery() {
- parent::buildQuery();
+
+ protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+ $query = parent::buildQuery($ids, $conditions, $revision_id);
// Specify additional fields from the user and node tables.
- $this->query->innerJoin('node', 'n', 'base.nid = n.nid');
- $this->query->addField('n', 'type', 'node_type');
- $this->query->innerJoin('users', 'u', 'base.uid = u.uid');
- $this->query->addField('u', 'name', 'registered_name');
- $this->query->fields('u', array('uid', 'signature', 'picture', 'data'));
+ $query->innerJoin('node', 'n', 'base.nid = n.nid');
+ $query->addField('n', 'type', 'node_type');
+ $query->innerJoin('users', 'u', 'base.uid = u.uid');
+ $query->addField('u', 'name', 'registered_name');
+ $query->fields('u', array('uid', 'signature', 'picture', 'data'));
+ return $query;
}
- protected function attachLoad(&$comments) {
+ protected function attachLoad(&$comments, $revision_id = FALSE) {
// Setup standard comment properties.
foreach ($comments as $key => $comment) {
$comment = drupal_unpack($comment);
@@ -1621,7 +1623,7 @@ class CommentController extends DrupalDefaultEntityController {
$comment->node_type = 'comment_node_' . $comment->node_type;
$comments[$key] = $comment;
}
- parent::attachLoad($comments);
+ parent::attachLoad($comments, $revision_id);
}
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 3e290f77b..8f50d83d9 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -3586,7 +3586,8 @@ function node_modules_enabled($modules) {
* special handling for node objects.
*/
class NodeController extends DrupalDefaultEntityController {
- protected function attachLoad(&$nodes) {
+
+ protected function attachLoad(&$nodes, $revision_id = FALSE) {
// Create an array of nodes for each content type and pass this to the
// object type specific callback.
$typed_nodes = array();
@@ -3602,6 +3603,6 @@ class NodeController extends DrupalDefaultEntityController {
}
}
$this->hookLoadArguments[] = array_keys($typed_nodes);
- parent::attachLoad($nodes);
+ parent::attachLoad($nodes, $revision_id);
}
}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 2a03f2d47..fb34cc4c4 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -865,32 +865,25 @@ function taxonomy_get_term_by_name($name) {
* that we match the condition on term name case-independently.
*/
class TaxonomyTermController extends DrupalDefaultEntityController {
- protected $type;
- public function load($ids = array(), $conditions = array()) {
- if (isset($conditions['type'])) {
- $this->type = $conditions['type'];
- unset($conditions['type']);
- }
- return parent::load($ids, $conditions);
- }
- protected function buildQuery() {
- parent::buildQuery();
- $this->query->addTag('translatable');
- $this->query->addTag('term_access');
+ protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+ $query = parent::buildQuery($ids, $conditions, $revision_id);
+ $query->addTag('translatable');
+ $query->addTag('term_access');
// When name is passed as a condition use LIKE.
- if (isset($this->conditions['name'])) {
- $conditions = &$this->query->conditions();
- foreach ($conditions as $key => $condition) {
+ if (isset($conditions['name'])) {
+ $query_conditions = &$query->conditions();
+ foreach ($query_conditions as $key => $condition) {
if ($condition['field'] == 'base.name') {
- $conditions[$key]['operator'] = 'LIKE';
- $conditions[$key]['value'] = db_like($conditions[$key]['value']);
+ $query_conditions[$key]['operator'] = 'LIKE';
+ $query_conditions[$key]['value'] = db_like($query_conditions[$key]['value']);
}
}
}
// Add the machine name field from the {taxonomy_vocabulary} table.
- $this->query->innerJoin('taxonomy_vocabulary', 'v', 'base.vid = v.vid');
- $this->query->addField('v', 'machine_name', 'vocabulary_machine_name');
+ $query->innerJoin('taxonomy_vocabulary', 'v', 'base.vid = v.vid');
+ $query->addField('v', 'machine_name', 'vocabulary_machine_name');
+ return $query;
}
protected function cacheGet($ids, $conditions = array()) {
@@ -899,7 +892,7 @@ class TaxonomyTermController extends DrupalDefaultEntityController {
// LOWER() and drupal_strtolower() may return different results.
foreach ($terms as $term) {
$term_values = (array) $term;
- if (isset($this->conditions['name']) && drupal_strtolower($this->conditions['name'] != drupal_strtolower($term_values['name']))) {
+ if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($term_values['name']))) {
unset($terms[$term->tid]);
}
}
@@ -914,21 +907,13 @@ class TaxonomyTermController extends DrupalDefaultEntityController {
* special handling for taxonomy vocabulary objects.
*/
class TaxonomyVocabularyController extends DrupalDefaultEntityController {
- protected function buildQuery() {
- parent::buildQuery();
- $this->query->addTag('translatable');
- $this->query->orderBy('base.weight');
- $this->query->orderBy('base.name');
- }
- protected function attachLoad(&$records) {
- foreach ($records as $record) {
- // If no node types are associated with a vocabulary, the LEFT JOIN will
- // return a NULL value for type.
- $queried_vocabularies[$record->vid] = $record;
- }
- $records = $queried_vocabularies;
- parent::attachLoad($records);
+ protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
+ $query = parent::buildQuery($ids, $conditions, $revision_id);
+ $query->addTag('translatable');
+ $query->orderBy('base.weight');
+ $query->orderBy('base.name');
+ return $query;
}
}
diff --git a/modules/user/user.module b/modules/user/user.module
index cff023dfa..8729c563d 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -228,7 +228,8 @@ function user_load_multiple($uids = array(), $conditions = array(), $reset = FAL
* special handling for user objects.
*/
class UserController extends DrupalDefaultEntityController {
- function attachLoad(&$queried_users) {
+
+ function attachLoad(&$queried_users, $revision_id = FALSE) {
// Build an array of user picture IDs so that these can be fetched later.
$picture_fids = array();
foreach ($queried_users as $key => $record) {
@@ -263,7 +264,7 @@ class UserController extends DrupalDefaultEntityController {
}
// Call the default attachLoad() method. This will add fields and call
// hook_user_load().
- parent::attachLoad($queried_users);
+ parent::attachLoad($queried_users, $revision_id);
}
}