diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 17:41:50 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 17:41:50 +0000 |
commit | faf079af4ddc0f35fc2b5835c20f184b4c93e303 (patch) | |
tree | 8909cfa7f9a221ff17dacc451b80f6f706e54dad /engine | |
parent | 9abd6ad3de13d4a5a6c6f00a216d6310d6df4cc0 (diff) | |
download | elgg-faf079af4ddc0f35fc2b5835c20f184b4c93e303.tar.gz elgg-faf079af4ddc0f35fc2b5835c20f184b4c93e303.tar.bz2 |
Fixes #2629: Pulled old initialise_attributes() into ElggData and added a default param to emit a deprecation notice if called.
git-svn-id: http://code.elgg.org/elgg/trunk@7387 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/classes/ElggData.php | 21 | ||||
-rw-r--r-- | engine/classes/ElggEntity.php | 14 | ||||
-rw-r--r-- | engine/classes/ElggGroup.php | 16 | ||||
-rw-r--r-- | engine/classes/ElggObject.php | 16 | ||||
-rw-r--r-- | engine/classes/ElggSite.php | 18 | ||||
-rw-r--r-- | engine/classes/ElggUser.php | 20 |
6 files changed, 34 insertions, 71 deletions
diff --git a/engine/classes/ElggData.php b/engine/classes/ElggData.php index a904cb923..2853a5298 100644 --- a/engine/classes/ElggData.php +++ b/engine/classes/ElggData.php @@ -24,6 +24,27 @@ abstract class ElggData implements protected $attributes = array(); /** + * 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 false|void False is + * @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); + } else { + return false; + } + } + + /** * Initialize the attributes array. * * This is vital to distinguish between metadata and base parameters. diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index c6ab51148..2d52ff6d8 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -61,20 +61,6 @@ abstract class ElggEntity extends ElggData implements protected $volatile = array(); /** - * Initialise the attributes array. - * - * This is vital to distinguish between metadata and base parameters. - * - * @return void - * @deprecated 1.8 Use initializeAttributes() - */ - protected function initialise_attributes() { - elgg_deprecated_notice('ElggEntity::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8); - - $this->initializeAttributes(); - } - - /** * Initialize the attributes array. * * This is vital to distinguish between metadata and base parameters. diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 448c1f7a6..81c1db138 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -9,7 +9,6 @@ class ElggGroup extends ElggEntity implements Friendable { - /** * Sets the type to group. * @@ -17,18 +16,6 @@ class ElggGroup extends ElggEntity * * @deprecated 1.8 Use initializeAttributes */ - protected function initialise_attributes() { - elgg_deprecated_notice('ElggGroup::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8); - return $this->initializeAttributes(); - } - - /** - * Sets the type to group. - * - * @return void - * - * @see ElggEntity::initialise_attributes() - */ protected function initializeAttributes() { parent::initializeAttributes(); @@ -49,6 +36,9 @@ class ElggGroup extends ElggEntity function __construct($guid = null) { $this->initializeAttributes(); + // compatibility for 1.7 api. + $this->initialise_attributes(false); + if (!empty($guid)) { // Is $guid is a DB row - either a entity row, or a user table row. if ($guid instanceof stdClass) { diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index 74c7be248..1d15bb305 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -16,19 +16,6 @@ * @subpackage DataModel.Object */ class ElggObject extends ElggEntity { - /** - * Initialise the attributes array to include the type, - * title, and description. - * - * @deprecated 1.8 use ElggEntity::initializeAttributes() - * - * @return void - */ - protected function initialise_attributes() { - elgg_deprecated_notice('ElggObject::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8); - - return $this->initializeAttributes(); - } /** * Initialise the attributes array to include the type, @@ -64,6 +51,9 @@ class ElggObject extends ElggEntity { function __construct($guid = null) { $this->initializeAttributes(); + // compatibility for 1.7 api. + $this->initialise_attributes(false); + if (!empty($guid)) { // Is $guid is a DB row - either a entity row, or a object table row. if ($guid instanceof stdClass) { diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index da239f1be..6c70d176b 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -23,21 +23,6 @@ * @link http://docs.elgg.org/DataModel/Sites */ class ElggSite extends ElggEntity { - /** - * Initialise the attributes array. - * This is vital to distinguish between metadata and base parameters. - * - * Place your base parameters here. - * - * @deprecated 1.8 Use ElggSite::initializeAttributes() - * - * @return void - */ - protected function initialise_attributes() { - elgg_deprecated_notice('ElggSite::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8); - - return $this->initializeAttributes(); - } /** * Initialise the attributes array. @@ -77,6 +62,9 @@ class ElggSite extends ElggEntity { function __construct($guid = null) { $this->initializeAttributes(); + // compatibility for 1.7 api. + $this->initialise_attributes(false); + if (!empty($guid)) { // Is $guid is a DB row - either a entity row, or a site table row. if ($guid instanceof stdClass) { diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index ab1bd71a0..071806529 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -9,23 +9,8 @@ */ class ElggUser extends ElggEntity implements Friendable { - /** - * Initialise the attributes array. - * This is vital to distinguish between metadata and base parameters. - * - * Place your base parameters here. - * - * @deprecated 1.8 Use ElggUser::initializeAttributes() - * - * @return void - */ - protected function initialise_attributes() { - elgg_deprecated_notice('ElggUser::initialise_attributes() is deprecated by ::initializeAttributes()', 1.8); - - return $this->initializeAttributes(); - } - /** + /** * Initialise the attributes array. * This is vital to distinguish between metadata and base parameters. * @@ -60,6 +45,9 @@ class ElggUser extends ElggEntity function __construct($guid = null) { $this->initializeAttributes(); + // compatibility for 1.7 api. + $this->initialise_attributes(false); + if (!empty($guid)) { // Is $guid is a DB row - either a entity row, or a user table row. if ($guid instanceof stdClass) { |