From 944b8f89b8dd87bf444503d0815aa69ed19f599d Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 20 Nov 2010 13:31:46 +0000 Subject: Fixes #2668 adding getOwnerGUID() git-svn-id: http://code.elgg.org/elgg/trunk@7378 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggData.php | 4 ++-- engine/classes/ElggEntity.php | 21 ++++++++++++++++----- engine/classes/ElggExtender.php | 21 ++++++++++++++++----- engine/classes/ElggUser.php | 21 +++++++++++++++++---- engine/classes/Loggable.php | 2 +- 5 files changed, 52 insertions(+), 17 deletions(-) (limited to 'engine/classes') 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]))) { @@ -704,19 +704,30 @@ abstract class ElggEntity extends ElggData implements return get_subtype_from_id($this->get('subtype')); } + /** + * 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 @@ -79,28 +79,39 @@ abstract class ElggExtender extends ElggData return true; } + /** + * 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 -- cgit v1.2.3