diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-31 00:14:47 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-31 00:14:47 +0000 |
commit | 5982c2ade2cec6302245ddb6897a6b66d9c48547 (patch) | |
tree | a7bc541c03aca31a83d31fe1cafee5d253eea34d | |
parent | 368cc50361cfe6a4fc3d8eec976ce67e080a55b4 (diff) | |
download | elgg-5982c2ade2cec6302245ddb6897a6b66d9c48547.tar.gz elgg-5982c2ade2cec6302245ddb6897a6b66d9c48547.tar.bz2 |
Refs #2597: Added getURL(), getTimeCreated(), and initializeAttributes() to {{{ElggData}}}
git-svn-id: http://code.elgg.org/elgg/trunk@7157 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/classes/ElggData.php | 43 | ||||
-rw-r--r-- | engine/classes/ElggEntity.php | 9 | ||||
-rw-r--r-- | engine/classes/ElggExtender.php | 7 |
3 files changed, 32 insertions, 27 deletions
diff --git a/engine/classes/ElggData.php b/engine/classes/ElggData.php index b21646df1..fbc11881a 100644 --- a/engine/classes/ElggData.php +++ b/engine/classes/ElggData.php @@ -4,6 +4,28 @@ abstract class ElggData implements Iterator, // Override foreach behaviour ArrayAccess // Override for array access { + + /** + * The main attributes of an entity. + * Holds attributes to save to database + * This contains the site's main properties (id, etc) + * Blank entries for all database fields should be created by the constructor. + * Subclasses should add to this in their constructors. + * Any field not appearing in this will be viewed as a + */ + protected $attributes = array(); + + protected function initializeAttributes() { + $this->attributes['time_created'] = time(); + } + + /** + * Get a URL for this object + * + * @return string + */ + abstract public function getURL(); + /** * Return the guid of the entity's owner. * @@ -19,7 +41,16 @@ abstract class ElggData implements * @return ElggEntity The owning user */ public function getOwnerEntity() { - return get_entity($this->getOwner()); + return get_entity($this->owner_guid); + } + + /** + * Returns the UNIX epoch time that this entity was created + * + * @return int UNIX epoch time + */ + public function getTimeCreated() { + return $this->time_created; } /* @@ -44,16 +75,6 @@ abstract class ElggData implements return $this->owner_guid; } - /** - * The main attributes of an entity. - * Holds attributes to save to database - * This contains the site's main properties (id, etc) - * Blank entries for all database fields should be created by the constructor. - * Subclasses should add to this in their constructors. - * Any field not appearing in this will be viewed as a - */ - protected $attributes; - /* * ITERATOR INTERFACE */ diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 5d0e030fc..86bf0727f 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -756,15 +756,6 @@ abstract class ElggEntity extends ElggData implements } /** - * Returns the UNIX epoch time that this entity was created - * - * @return int UNIX epoch time - */ - public function getTimeCreated() { - return $this->get('time_created'); - } - - /** * Returns the UNIX epoch time that this entity was last updated * * @return int UNIX epoch time diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php index 2c2669e28..d9a6a52ef 100644 --- a/engine/classes/ElggExtender.php +++ b/engine/classes/ElggExtender.php @@ -109,13 +109,6 @@ abstract class ElggExtender extends ElggData implements return can_edit_extender($this->id, $this->type, $user_guid); } - /** - * Return a url for this extender. - * - * @return string - */ - public abstract function getURL(); - /* * EXPORTABLE INTERFACE */ |