]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2629: Pulled old initialise_attributes() into ElggData and added a default...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 17:41:50 +0000 (17:41 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 17:41:50 +0000 (17:41 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7387 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggData.php
engine/classes/ElggEntity.php
engine/classes/ElggGroup.php
engine/classes/ElggObject.php
engine/classes/ElggSite.php
engine/classes/ElggUser.php

index a904cb923e9546979f80f0fa93c0688570ed12a7..2853a5298ee15914e014160463640ac676c39fc3 100644 (file)
@@ -23,6 +23,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.
         *
index c6ab51148cea00e016d1711d40293c8833d39462..2d52ff6d8887a594abf141b999ef39d36dac4f14 100644 (file)
@@ -60,20 +60,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.
         *
index 448c1f7a694e1a6176deab78dbfacb134c01283a..81c1db138bd20bab1b24923af9b55ec4b8f88094 100644 (file)
@@ -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) {
index 74c7be248fb67f91526cb3b3b5c351af3fd46ccb..1d15bb305bbd55b4405a65ae964935512e9b7024 100644 (file)
  * @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) {
index da239f1be6b63b837e18d50e0565c0dbfd06b934..6c70d176b965322abd9291cb30df841abe179f52 100644 (file)
  * @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) {
index ab1bd71a0c11303bae501d1e4aebb333011b4c63..071806529aefb485d1d5c56a6ad35c0006c81774 100644 (file)
@@ -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) {