diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/metadata.php | 28 | ||||
-rw-r--r-- | engine/tests/objects/metadata.php | 8 |
2 files changed, 18 insertions, 18 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index ea1ce412d..342910d47 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -553,23 +553,23 @@ function find_metadata($meta_name = "", $meta_value = "", $entity_type = "", $en */ function elgg_get_entities_from_metadata(array $options = array()) { $defaults = array( - 'names' => NULL, - 'name' => NULL, - 'values' => NULL, - 'value' => NULL, - 'name_value_pair' => NULL, - 'name_value_pairs' => NULL, - 'name_value_pairs_operator' => 'AND', - 'case_sensitive' => TRUE + 'metadata_names' => NULL, + 'metadata_name' => NULL, + 'metadata_values' => NULL, + 'metadata_value' => NULL, + 'metadata_name_value_pair' => NULL, + 'metadata_name_value_pairs' => NULL, + 'metadata_name_value_pairs_operator' => 'AND', + 'metadata_case_sensitive' => TRUE ); $options = array_merge($defaults, $options); - $singulars = array('name', 'value', 'name_value_pair'); + $singulars = array('metadata_name', 'metadata_value', 'metadata_name_value_pair'); $options = elgg_normalise_plural_options_array($options, $singulars); - $clauses = elgg_get_entity_metadata_where_sql('e', $options['names'], $options['values'], - $options['name_value_pairs'], $options['name_value_pairs_operator'], $options['case_sensitive']); + $clauses = elgg_get_entity_metadata_where_sql('e', $options['metadata_names'], $options['metadata_values'], + $options['metadata_name_value_pairs'], $options['metadata_name_value_pairs_operator'], $options['metadata_case_sensitive']); if ($clauses) { // merge wheres to pass to get_entities() @@ -794,10 +794,10 @@ $count = FALSE, $case_sensitive = TRUE) { $options = array(); - $options['names'] = $meta_name; + $options['metadata_names'] = $meta_name; if ($meta_value) { - $options['values'] = $meta_value; + $options['metadata_values'] = $meta_value; } if ($entity_type) { @@ -833,7 +833,7 @@ $count = FALSE, $case_sensitive = TRUE) { } // need to be able to pass false - $options['case_sensitive'] = $case_sensitive; + $options['metadata_case_sensitive'] = $case_sensitive; return elgg_get_entities_from_metadata($options); } diff --git a/engine/tests/objects/metadata.php b/engine/tests/objects/metadata.php index 2728a5add..bc6523279 100644 --- a/engine/tests/objects/metadata.php +++ b/engine/tests/objects/metadata.php @@ -62,20 +62,20 @@ class ElggCoreMetadataTest extends ElggCoreUnitTest { $this->assertTrue(create_metadata($this->object->guid, 'metaUnitTest', 'tested')); // check value with improper case - $options = array('names' => 'metaUnitTest', 'values' => 'Tested', 'limit' => 10, 'case_sensitive' => TRUE); + $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); $this->assertFalse(elgg_get_entities_from_metadata($options)); // compare forced case with ignored case - $options = array('names' => 'metaUnitTest', 'values' => 'tested', 'limit' => 10, 'case_sensitive' => TRUE); + $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); $case_true = elgg_get_entities_from_metadata($options); $this->assertIsA($case_true, 'array'); - $options = array('names' => 'metaUnitTest', 'values' => 'Tested', 'limit' => 10, 'case_sensitive' => FALSE); + $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => FALSE); $case_false = elgg_get_entities_from_metadata($options); $this->assertIsA($case_false, 'array'); $this->assertIdentical($case_true, $case_false); - + // check deprecated get_entities_from_metadata() function $deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE); $this->assertIdentical($deprecated, $case_true); |