aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-20 13:31:46 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-20 13:31:46 +0000
commit944b8f89b8dd87bf444503d0815aa69ed19f599d (patch)
tree6786d1a4cf55f27ca6fa46364da649932b750e7e /engine
parentffd932df92f857a9607b119a0953ee353c422119 (diff)
downloadelgg-944b8f89b8dd87bf444503d0815aa69ed19f599d.tar.gz
elgg-944b8f89b8dd87bf444503d0815aa69ed19f599d.tar.bz2
Fixes #2668 adding getOwnerGUID()
git-svn-id: http://code.elgg.org/elgg/trunk@7378 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggData.php4
-rw-r--r--engine/classes/ElggEntity.php21
-rw-r--r--engine/classes/ElggExtender.php21
-rw-r--r--engine/classes/ElggUser.php21
-rw-r--r--engine/classes/Loggable.php2
-rw-r--r--engine/lib/entities.php2
-rw-r--r--engine/lib/extender.php2
-rw-r--r--engine/tests/objects/entities.php2
8 files changed, 55 insertions, 20 deletions
diff --git a/engine/classes/ElggData.php b/engine/classes/ElggData.php
index a6cf7d21f..a904cb923 100644
--- a/engine/classes/ElggData.php
+++ b/engine/classes/ElggData.php
@@ -141,10 +141,10 @@ abstract class ElggData implements
* Return the GUID of the owner of this object.
*
* @return int
- * @deprecated 1.8 Use getOwner() instead
+ * @deprecated 1.8 Use getOwnerGUID() instead
*/
public function getObjectOwnerGUID() {
- elgg_deprecated_notice("getObjectOwnerGUID() was deprecated. Use getOwner().", 1.8);
+ elgg_deprecated_notice("getObjectOwnerGUID() was deprecated. Use getOwnerGUID().", 1.8);
return $this->owner_guid;
}
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 667302c30..de57d7a07 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -297,7 +297,7 @@ abstract class ElggEntity extends ElggData implements
if ((int) $this->guid > 0) {
$multiple = true;
if (!create_metadata($this->getGUID(), $name, $v, $value_type,
- $this->getOwner(), $this->getAccessID(), $multiple)) {
+ $this->getOwnerGUID(), $this->getAccessID(), $multiple)) {
return false;
}
} else {
@@ -320,7 +320,7 @@ abstract class ElggEntity extends ElggData implements
unset($this->temp_metadata[$name]);
if ((int) $this->guid > 0) {
$result = create_metadata($this->getGUID(), $name, $value, $value_type,
- $this->getOwner(), $this->getAccessID(), $multiple);
+ $this->getOwnerGUID(), $this->getAccessID(), $multiple);
return (bool)$result;
} else {
if (($multiple) && (isset($this->temp_metadata[$name]))) {
@@ -705,18 +705,29 @@ abstract class ElggEntity extends ElggData implements
}
/**
+ * Get the guid of the entity's owner.
+ *
+ * @return int The owner GUID
+ */
+ public function getOwnerGUID() {
+ return $this->owner_guid;
+ }
+
+ /**
* Return the guid of the entity's owner.
*
* @return int The owner GUID
+ * @deprecated 1.8 Use getOwnerGUID()
*/
public function getOwner() {
- return $this->owner_guid;
+ elgg_deprecated_notice("ElggEntity::getOwner deprecated for ElggEntity::getOwnerGUID", 1.8);
+ return $this->getOwnerGUID();
}
/**
- * Returns the ElggEntity or child object of the owner of the entity.
+ * Gets the ElggEntity that owns this entity.
*
- * @return ElggEntity The owning user
+ * @return ElggEntity The owning entity
*/
public function getOwnerEntity() {
return get_entity($this->owner_guid);
diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php
index 95a4d3de3..6ab9ff3ce 100644
--- a/engine/classes/ElggExtender.php
+++ b/engine/classes/ElggExtender.php
@@ -80,27 +80,38 @@ abstract class ElggExtender extends ElggData
}
/**
+ * Get the GUID of the extender's owner entity.
+ *
+ * @return int The owner GUID
+ */
+ public function getOwnerGUID() {
+ return $this->owner_guid;
+ }
+
+ /**
* Return the guid of the entity's owner.
*
* @return int The owner GUID
+ * @deprecated 1.8 Use getOwnerGUID
*/
public function getOwner() {
- return $this->owner_guid;
+ elgg_deprecated_notice("ElggExtender::getOwner deprecated for ElggExtender::getOwnerGUID", 1.8);
+ return $this->getOwnerGUID();
}
/**
- * Returns the ElggEntity or child object of the owner of the entity.
+ * Get the entity that owns this extender
*
- * @return ElggEntity The owning user
+ * @return ElggEntity
*/
public function getOwnerEntity() {
return get_entity($this->owner_guid);
}
/**
- * Return the entity this describes.
+ * Get the entity this describes.
*
- * @return ElggEntity The enttiy
+ * @return ElggEntity The entity
*/
public function getEntity() {
return get_entity($this->entity_guid);
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php
index 8f30be37e..ab1bd71a0 100644
--- a/engine/classes/ElggUser.php
+++ b/engine/classes/ElggUser.php
@@ -420,18 +420,31 @@ class ElggUser extends ElggEntity
}
/**
- * If a user's owner is blank, return its own GUID as the owner
+ * Get a user's owner GUID
*
- * @return int User GUID
+ * Returns it's own GUID if the user is not owned.
+ *
+ * @return int
*/
- function getOwner() {
+ function getOwnerGUID() {
if ($this->owner_guid == 0) {
- return $this->getGUID();
+ return $this->guid;
}
return $this->owner_guid;
}
+ /**
+ * If a user's owner is blank, return its own GUID as the owner
+ *
+ * @return int User GUID
+ * @deprecated 1.8 Use getOwnerGUID()
+ */
+ function getOwner() {
+ elgg_deprecated_notice("ElggUser::getOwner deprecated for ElggUser::getOwnerGUID", 1.8);
+ $this->getOwnerGUID();
+ }
+
// EXPORTABLE INTERFACE ////////////////////////////////////////////////////////////
/**
diff --git a/engine/classes/Loggable.php b/engine/classes/Loggable.php
index 36db8a692..40690f87a 100644
--- a/engine/classes/Loggable.php
+++ b/engine/classes/Loggable.php
@@ -59,7 +59,7 @@ interface Loggable {
* Return the GUID of the owner of this object.
*
* @return int
- * @deprecated 1.8 Use getOwner() instead
+ * @deprecated 1.8 Use getOwnerGUID() instead
*/
public function getObjectOwnerGUID();
} \ No newline at end of file
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index cac2e2959..57a98ae40 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1930,7 +1930,7 @@ function can_edit_entity($entity_guid, $user_guid = 0) {
// Test user if possible - should default to false unless a plugin hook says otherwise
if ($user) {
- if ($entity->getOwner() == $user->getGUID()) {
+ if ($entity->getOwnerGUID() == $user->getGUID()) {
$return = true;
}
if ($entity->container_guid == $user->getGUID()) {
diff --git a/engine/lib/extender.php b/engine/lib/extender.php
index b894c5e59..8df207767 100644
--- a/engine/lib/extender.php
+++ b/engine/lib/extender.php
@@ -144,7 +144,7 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) {
}
// If the owner is the specified user, great! They can edit.
- if ($extender->getOwner() == $user->getGUID()) {
+ if ($extender->getOwnerGUID() == $user->getGUID()) {
return true;
}
diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php
index 97cf44392..56c8f7947 100644
--- a/engine/tests/objects/entities.php
+++ b/engine/tests/objects/entities.php
@@ -77,7 +77,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
$this->assertIdentical($this->entity->getGUID(), $this->entity->guid );
$this->assertIdentical($this->entity->getType(), $this->entity->type );
$this->assertIdentical($this->entity->getSubtype(), $this->entity->subtype );
- $this->assertIdentical($this->entity->getOwner(), $this->entity->owner_guid );
+ $this->assertIdentical($this->entity->getOwnerGUID(), $this->entity->owner_guid );
$this->assertIdentical($this->entity->getAccessID(), $this->entity->access_id );
$this->assertIdentical($this->entity->getTimeCreated(), $this->entity->time_created );
$this->assertIdentical($this->entity->getTimeUpdated(), $this->entity->time_updated );