diff options
Diffstat (limited to 'engine/classes/ElggData.php')
| -rw-r--r-- | engine/classes/ElggData.php | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/engine/classes/ElggData.php b/engine/classes/ElggData.php index 96de1bc8f..4f843cde4 100644 --- a/engine/classes/ElggData.php +++ b/engine/classes/ElggData.php @@ -5,6 +5,9 @@ * * @package Elgg.Core * @subpackage DataModel + * + * @property int $owner_guid + * @property int $time_created */ abstract class ElggData implements Loggable, // Can events related to this object class be logged @@ -23,6 +26,27 @@ abstract class ElggData implements */ protected $attributes = array(); + // @codingStandardsIgnoreStart + /** + * Initialise the attributes array. + * + * This is vital to distinguish between metadata and base parameters. + * + * @param bool $pre18_api Compatibility for subclassing in 1.7 -> 1.8 change. + * Passing true (default) emits a deprecation notice. + * Passing false returns false. Core constructors always pass false. + * Does nothing either way since attributes are initialized by the time + * this is called. + * @return void + * @deprecated 1.8 Use initializeAttributes() + */ + protected function initialise_attributes($pre18_api = true) { + if ($pre18_api) { + elgg_deprecated_notice('initialise_attributes() is deprecated by initializeAttributes()', 1.8); + } + } + // @codingStandardsIgnoreEnd + /** * Initialize the attributes array. * @@ -36,7 +60,7 @@ abstract class ElggData implements $this->attributes = array(); } - $this->attributes['time_created'] = ''; + $this->attributes['time_created'] = NULL; } /** @@ -90,7 +114,7 @@ abstract class ElggData implements * @param string $name The attribute to set * @param mixed $value The value to set it to * - * @return The success of your set funtion? + * @return bool The success of your set function? */ abstract protected function set($name, $value); @@ -107,7 +131,7 @@ abstract class ElggData implements * @return bool */ abstract public function save(); - + /** * Delete this data. * @@ -141,10 +165,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; } @@ -174,7 +198,7 @@ abstract class ElggData implements * * @see Iterator::current() * - * @return void + * @return mixed */ public function current() { return current($this->attributes); @@ -185,7 +209,7 @@ abstract class ElggData implements * * @see Iterator::key() * - * @return void + * @return string */ public function key() { return key($this->attributes); @@ -207,7 +231,7 @@ abstract class ElggData implements * * @see Iterator::valid() * - * @return void + * @return bool */ public function valid() { return $this->valid; @@ -245,12 +269,13 @@ abstract class ElggData implements * * @param mixed $key Name * - * @return void + * @return mixed */ public function offsetGet($key) { if (array_key_exists($key, $this->attributes)) { return $this->attributes[$key]; } + return null; } /** @@ -281,4 +306,4 @@ abstract class ElggData implements public function offsetExists($offset) { return array_key_exists($offset, $this->attributes); } -}
\ No newline at end of file +} |
