diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-29 21:21:30 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-29 21:21:30 +0000 |
commit | 1770180c274d981f2dcf8a4791753de54652f51b (patch) | |
tree | 11fceff525381414c782dfd3e1a2e8754a5dcfdd /engine/lib/metadata.php | |
parent | 28767f949a8231d808fb68b764eb65f63b03f138 (diff) | |
download | elgg-1770180c274d981f2dcf8a4791753de54652f51b.tar.gz elgg-1770180c274d981f2dcf8a4791753de54652f51b.tar.bz2 |
Deprecated get_entities_from_relationships_and_meta().
git-svn-id: http://code.elgg.org/elgg/trunk@3603 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r-- | engine/lib/metadata.php | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 1d6fc59f4..ea1ce412d 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -571,23 +571,25 @@ function elgg_get_entities_from_metadata(array $options = array()) { $clauses = elgg_get_entity_metadata_where_sql('e', $options['names'], $options['values'], $options['name_value_pairs'], $options['name_value_pairs_operator'], $options['case_sensitive']); - // merge wheres to pass to get_entities() - if (isset($options['wheres']) && !is_array($options['wheres'])) { - $options['wheres'] = array($options['wheres']); - } elseif (!isset($options['wheres'])) { - $options['wheres'] = array(); - } + if ($clauses) { + // merge wheres to pass to get_entities() + if (isset($options['wheres']) && !is_array($options['wheres'])) { + $options['wheres'] = array($options['wheres']); + } elseif (!isset($options['wheres'])) { + $options['wheres'] = array(); + } - $options['wheres'][] = $clauses['wheres']; + $options['wheres'] = array_merge($options['wheres'], $clauses['wheres']); - // merge joins to pass to get_entities() - if (isset($options['joins']) && !is_array($options['joins'])) { - $options['joins'] = array($options['joins']); - } elseif (!isset($options['joins'])) { - $options['joins'] = array(); - } + // merge joins to pass to get_entities() + if (isset($options['joins']) && !is_array($options['joins'])) { + $options['joins'] = array($options['joins']); + } elseif (!isset($options['joins'])) { + $options['joins'] = array(); + } - $options['joins'] = array_merge($options['joins'], $clauses['joins']); + $options['joins'] = array_merge($options['joins'], $clauses['joins']); + } return elgg_get_entities($options); } @@ -629,6 +631,8 @@ function elgg_get_entity_metadata_where_sql($table, $names = NULL, $values = NUL 'wheres' => array() ); + $wheres = array(); + // get names wheres and joins $names_where = ''; if ($names !== NULL) { @@ -758,7 +762,9 @@ function elgg_get_entity_metadata_where_sql($table, $names = NULL, $values = NUL } } - $return['wheres'] = implode(' OR ', $wheres); + if ($where = implode(' OR ', $wheres)) { + $return['wheres'][] = "($where)"; + } return $return; } |