Total fee now updates when a new fee is added

This commit is contained in:
2022-04-21 12:11:56 +01:00
parent 4ab621100f
commit 02715bdc44
3 changed files with 10 additions and 1 deletions

View File

@ -222,6 +222,10 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface
return $this;
}
public function addToTotalFee(float $amountToAdd): void {
$this->set('total_fee', $this->total_fee->value + $amountToAdd);
$this->save();
}
/**
* {@inheritdoc}

View File

@ -190,6 +190,10 @@ class OCCaseFee extends EditorialContentEntityBase implements OCCaseFeeInterface
return $this;
}
public function getCase():\Drupal\opencase_cases\Entity\OCCase {
return \Drupal\opencase_cases\Entity\OCCase::load($this->oc_case->target_id);
}
/**
* {@inheritdoc}
*/