diff --git a/.doc/README.md b/.doc/README.md index 6221bf2c1..e6c294bc1 100644 --- a/.doc/README.md +++ b/.doc/README.md @@ -23,7 +23,7 @@ Some iTop specific tags were added : ### known limitations: #### `@see` tags must be very specific: - * always prefix class members with `ClassName::` + * always prefix class members (attributes or methods) with `ClassName::` (do not use self) * for methods always suffix them with `()`, * do not reference variables since they are not documented. If you have to, always prefix them with `$` diff --git a/application/applicationextension.inc.php b/application/applicationextension.inc.php index 67f3ed6a9..59e346f8b 100644 --- a/application/applicationextension.inc.php +++ b/application/applicationextension.inc.php @@ -421,7 +421,10 @@ interface iApplicationObjectExtension * Invoked when an object is updated into the database. The method is called right after the object has been written to the * database. * - * Changes made to the object can be get using {@link $oObject::ListChangesUpdated()}. Do not call {@link \DBObject::ListChanges} for this purpose because it will be empty as the object has already be written to DB! + * Useful methods you can call on $oObject : + * + * * {@see DBObject::ListPreviousValuesForUpdatedAttributes()} : list of changed attributes and their values before the change + * * {@see DBObject::Get()} : for a given attribute the new value that was persisted * * @param \cmdbAbstractObject $oObject The target object * @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information @@ -429,7 +432,7 @@ interface iApplicationObjectExtension * * @return void * - * @since 2.7.0 N°2293 can access object changes by calling {@link $oObject::ListChangesUpdated()} + * @since 2.7.0 N°2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} on $oObject */ public function OnDBUpdate($oObject, $oChange = null); diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 276217563..a4f634892 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -83,8 +83,9 @@ abstract class DBObject implements iDisplay /** @var bool true IF the object is mapped to a DB record */ protected $m_bIsInDB = false; protected $m_iKey = null; - /** @var array key: attcode, value: corresponding current value (in memory, before persisting object) */ + /** @var array attcode => value : corresponding current value (the new value passed to {@see DBObject::Set()}). Reset during {@see DBObject::DBUpdate()} */ private $m_aCurrValues = array(); + /** @var array attcode => value : previous values before the {@see DBObject::Set()} call. Array is reset at the end of {@see DBObject::DBUpdate()} */ protected $m_aOrigValues = array(); protected $m_aExtendedData = null; @@ -97,7 +98,8 @@ abstract class DBObject implements iDisplay private $m_bDirty = false; /** - * @var boolean|null true if the object has been verified and is consistent with integrity rules. If null, then the check has to be performed again to know the status + * @var boolean|null true if the object has been verified and is consistent with integrity rules. + * If null, then the check has to be performed again to know the status * @see CheckToWrite() */ private $m_bCheckStatus = null; @@ -134,10 +136,11 @@ abstract class DBObject implements iDisplay */ protected $m_aModifiedAtt = array(); /** - * @var array attname => currentvalue Persists changes for {@link DBUpdate} + * @var array attname => value : value before the last {@see DBObject::Set()} call. Set at the beginning of {@see DBObject::DBUpdate()}. + * @see DBObject::ListPreviousValuesForUpdatedAttributes() getter for this attribute * @since 2.7.0 N°2293 */ - protected $m_aChanges; + protected $m_aPreviousValuesForUpdatedAttributes; /** * @var array Set of Synch data related to this object *