]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2597: Added getURL(), getTimeCreated(), and initializeAttributes() to {{{ElggDa...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 31 Oct 2010 00:14:47 +0000 (00:14 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 31 Oct 2010 00:14:47 +0000 (00:14 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7157 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggData.php
engine/classes/ElggEntity.php
engine/classes/ElggExtender.php

index b21646df1058ac003527f2ff96ba62b111c6b32d..fbc11881a22512ef82095735e4f4562260900a56 100644 (file)
@@ -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
         */
index 5d0e030fc24f9d0bc285460b0b8d88b7095497f7..86bf0727f7173707c203b71b53511df50b60e668 100644 (file)
@@ -755,15 +755,6 @@ abstract class ElggEntity extends ElggData implements
                return get_subtype_from_id($this->get('subtype'));
        }
 
-       /**
-        * 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
         *
index 2c2669e2819fb6fd9590b14bf2503da12214a1dc..d9a6a52ef6fd191e898059442a8cc71de0bfa09c 100644 (file)
@@ -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
         */