Event "Compute Values"

This commit is contained in:
Eric Espie
2022-06-01 09:09:16 +02:00
parent f6855b0d2b
commit c7e54c66c8
3 changed files with 28 additions and 31 deletions

View File

@@ -5723,10 +5723,6 @@ JS
*/
final protected function EventInsertRequested()
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
IssueLog::Debug("CRUD: DBInsert $sClass::0 Requested", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_INSERT_REQUESTED);
}
@@ -5736,10 +5732,6 @@ JS
*/
final protected function EventInsertBefore()
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
IssueLog::Debug("CRUD: DBInsert $sClass::0 About to write in DB", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_ABOUT_TO_INSERT);
}
@@ -5749,14 +5741,14 @@ JS
*/
final protected function EventInsertAfter()
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
IssueLog::Debug("CRUD: $sClass::{$this->m_iKey} Inserted in DB", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_INSERT_DONE);
}
final protected function EventComputeValues()
{
$this->FireEvent(EVENT_SERVICE_DB_COMPUTE_VALUES);
}
/**
* @param array $aEventData
*
@@ -5785,12 +5777,6 @@ JS
*/
final protected function EventUpdateRequested()
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
$sKey = $sClass.'::'.$this->GetKey();
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Requested", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_UPDATE_REQUESTED);
}
@@ -5800,11 +5786,6 @@ JS
*/
final protected function EventUpdateBefore()
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
$sKey = $sClass.'::'.$this->GetKey();
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey About to be written in DB", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_ABOUT_TO_UPDATE);
}
@@ -5816,11 +5797,6 @@ JS
*/
final protected function EventUpdateAfter(array $aEventData)
{
$sClass = get_class($this);
if ($sClass == 'UserRequest') {
$sKey = $sClass.'::'.$this->GetKey();
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Updated", LogChannels::DM_CRUD);
}
$this->FireEvent(EVENT_SERVICE_DB_UPDATE_DONE, $aEventData);
}

View File

@@ -186,6 +186,23 @@
</menu>
</menus>
<events>
<event id="EVENT_SERVICE_DB_COMPUTE_VALUES" _delta="define">
<description>An object needs to be recomputed after changes</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>DBObject::ComputeValues</replaces>
<event_data>
<event_datum id="object">
<description>The object inserted</description>
<type>DBObject</type>
</event_datum>
<event_datum id="debug_info">
<description>Debug string</description>
<type>string</type>
</event_datum>
</event_data>
</event>
<event id="EVENT_SERVICE_DB_INSERT_REQUESTED" _delta="define">
<description>An object insert in the database has been requested. All changes to the object will be persisted automatically.</description>
<sources>

View File

@@ -1049,7 +1049,7 @@ abstract class DBObject implements iDisplay
if ($aCallInfo["function"] != "ComputeValues") continue;
return; //skip!
}
$this->EventComputeValues();
$this->ComputeValues();
}
@@ -2305,7 +2305,7 @@ abstract class DBObject implements iDisplay
* @throws \OQLException
*
*/
final public function CheckToWrite($bDoComputeValues = true)
public function CheckToWrite($bDoComputeValues = true)
{
if (MetaModel::SkipCheckToWrite())
{
@@ -5829,6 +5829,10 @@ abstract class DBObject implements iDisplay
{
}
protected function EventComputeValues()
{
}
protected function EventCheckToWrite(array $aEventData)
{
}