Skip to content

Commit

Permalink
N°4756 - ✅ Ease extensibility for CRUD operations : Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eespie committed Jan 12, 2023
1 parent 5d1852f commit 06a5d64
Show file tree
Hide file tree
Showing 3 changed files with 752 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/dbobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3345,10 +3345,12 @@ public function DBUpdate()
$this->m_bDirty = false;
$this->m_aTouchedAtt = array();
$this->m_aModifiedAtt = array();

$bModifiedByUpdateDone = false;
try {
$this->EventUpdateDone($aChanges);
$this->AfterUpdate();
// Save the status as it is reset just after...
$bModifiedByUpdateDone = $this->IsModified();

// Reset original values although the object has not been reloaded
foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) {
Expand Down Expand Up @@ -3388,7 +3390,7 @@ public function DBUpdate()
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
}

if ($this->IsModified()) {
if ($this->IsModified() || $bModifiedByUpdateDone) {
// Controlled reentrance
$this->DBUpdate();
}
Expand Down
Loading

0 comments on commit 06a5d64

Please sign in to comment.