aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 15:22:41 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-30 15:22:41 +0000
commit46fc19c79fcd51bfdd86642bbdea7b2910a59a23 (patch)
treeedb8adbdb458acf4154fddce57158b7e023cd41f /engine/lib
parent448aa6dfa286f46cacd83df1bc239db06c326c79 (diff)
downloadelgg-46fc19c79fcd51bfdd86642bbdea7b2910a59a23.tar.gz
elgg-46fc19c79fcd51bfdd86642bbdea7b2910a59a23.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Changed "verb" to "type" in relationship, as described in ODD spec 0.5 git-svn-id: https://code.elgg.org/elgg/trunk@582 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/export.php47
-rw-r--r--engine/lib/relationships.php17
2 files changed, 9 insertions, 55 deletions
diff --git a/engine/lib/export.php b/engine/lib/export.php
index 3eb22aba2..a44160758 100644
--- a/engine/lib/export.php
+++ b/engine/lib/export.php
@@ -242,12 +242,12 @@
*/
class ODDRelationship extends ODD
{
- function __construct($uuid1, $verb, $uuid2)
+ function __construct($uuid1, $type, $uuid2)
{
parent::__construct();
$this->setAttribute('uuid1', $uuid1);
- $this->setAttribute('verb', $verb);
+ $this->setAttribute('type', $type);
$this->setAttribute('uuid2', $uuid2);
}
@@ -286,49 +286,6 @@
return $odd;
}
- /** Relationship verb mapping */
- $ODD_RELATIONSHIP_VERBS = array();
-
- /**
- * This function provides a mapping between entity relationships and ODD relationship verbs.
- * @param string $relationship The relationship as stored in the database, eg "friend" or "member of"
- * @param string $verb The verb, eg "friends" or "joins"
- */
- function register_odd_relationship_mapping($relationship, $verb)
- {
- global $ODD_RELATIONSHIP_VERBS;
-
- $ODD_RELATIONSHIP_VERBS[$relationship] = $verb;
- }
-
- /**
- * Return a mapping for relationship to a pre-registered ODD verb, or false.
- * @param string $relationship The relationship
- */
- function get_verb_from_relationship($relationship)
- {
- global $ODD_RELATIONSHIP_VERBS;
-
- if (isset($ODD_RELATIONSHIP_VERBS[$relationship]))
- return $ODD_RELATIONSHIP_VERBS[$relationship];
-
- return false;
- }
-
- /**
- * Return the relationship registered with a given verb, or false.
- * @param string $verb The verb.
- */
- function get_relationship_from_verb($verb)
- {
- global $ODD_RELATIONSHIP_VERBS;
-
- foreach ($ODD_RELATIONSHIP_VERBS as $k => $v)
- if ($v == $verb) return $k;
-
- return false;
- }
-
/**
* Generate a UUID from a given GUID.
*
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index a3bb10ca1..071e5ece2 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -115,14 +115,10 @@
* @return array
*/
public function export()
- {
- $verb = get_verb_from_relationship($this->relationship);
- if (!$verb)
- throw new ExportException("There is no verb mapping for '{$this->relationship}'.");
-
+ {
return new ODDRelationship(
guid_to_uuid($this->guid_one),
- $verb,
+ $this->relationship,
guid_to_uuid($this->guid_two)
);
}
@@ -155,8 +151,9 @@
$this->attributes['guid_two'] = $entity2->getGUID();
// Map verb to relationship
- $verb = $data->getAttribute('verb');
- $relationship = get_relationship_from_verb($verb);
+ //$verb = $data->getAttribute('verb');
+ //$relationship = get_relationship_from_verb($verb);
+ $relationship = $data->getAttribute('type');
if ($relationship)
{
@@ -477,8 +474,8 @@
}
/** Register the import hook */
- register_plugin_hook("import", "all", "import_relationship_plugin_hook", 1);
+ register_plugin_hook("import", "all", "import_relationship_plugin_hook", 3);
/** Register the hook, ensuring entities are serialised first */
- register_plugin_hook("export", "all", "export_relationship_plugin_hook", 1);
+ register_plugin_hook("export", "all", "export_relationship_plugin_hook", 3);
?> \ No newline at end of file