From d82690dd845ca2f2b78377209a7a5021c8474b21 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 29 Jan 2020 17:25:29 +0100 Subject: [PATCH 1/6] =?UTF-8?q?N=C2=B02293=20DBUpdate=20:=20save=20changed?= =?UTF-8?q?=20fields=20and=20corresponding=20previous=20values=20for=20cal?= =?UTF-8?q?lbacks=20*=20update=20PHPDoc=20*=20remove=20m=5FaChanges=20and?= =?UTF-8?q?=20ListChangesUpdated()=20that=20were=20introduced=20in=202.7.0?= =?UTF-8?q?-beta=20*=20add=20m=5FaPreviousValuesForUpdatedAttributes=20and?= =?UTF-8?q?=20ListPreviousValuesForUpdatedAttributes()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobject.class.php | 93 ++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 33 deletions(-) diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 276217563..3cb1c2489 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 {@link Set}). Reset during {@link DBUpdate} */ private $m_aCurrValues = array(); + /** @var array attcode => value : previous values before the {@link Set} call. Array is reset at the end of {@link 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 {@link Set} call. Set at the beginning of {@link DBUpdate}. + * @see 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 *