aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metadata.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-29 21:21:30 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-29 21:21:30 +0000
commit1770180c274d981f2dcf8a4791753de54652f51b (patch)
tree11fceff525381414c782dfd3e1a2e8754a5dcfdd /engine/lib/metadata.php
parent28767f949a8231d808fb68b764eb65f63b03f138 (diff)
downloadelgg-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.php36
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;
}