N°4756 - Ease extensibility for CRUD operations : Reduce events after review

This commit is contained in:
Eric Espie
2023-01-04 14:18:01 +01:00
parent cd17eb484a
commit a693c343e8
3 changed files with 1 additions and 74 deletions

View File

@@ -5674,15 +5674,6 @@ JS
$this->FireEvent(EVENT_DB_CHECK_TO_WRITE);
}
/**
* @inheritDoc
* @since 3.1.0
*/
final protected function EventCheckToWriteFailed(array $aIssues): void
{
$this->FireEvent(EVENT_DB_CHECK_TO_WRITE_FAILED, ['check_issues' => $aIssues]);
}
/**
* @inheritDoc
* @since 3.1.0
@@ -5718,15 +5709,6 @@ JS
$this->FireEvent(EVENT_DB_CHECK_TO_DELETE, ['deletion_plan' => $oDeletionPlan]);
}
/**
* @inheritDoc
* @since 3.1.0
*/
final protected function EventCheckToDeleteFailed(array $aIssues): void
{
$this->FireEvent(EVENT_DB_CHECK_TO_DELETE_FAILED, ['check_issues' => $aIssues]);
}
/**
* @inheritDoc
* @since 3.1.0

View File

@@ -203,22 +203,6 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_DB_CHECK_TO_WRITE_FAILED" _delta="define">
<description>A check has failed, it is not possible to write the object in DB</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<event_data>
<event_datum id="object">
<description>The object to check</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_DB_CREATE_DONE" _delta="define">
<description>An object has been created into the database. The modifications can be propagated to other objects.</description>
<sources>
@@ -270,27 +254,6 @@
</event_datum>
</event_data>
</event>
<event id="EVENT_DB_CHECK_TO_DELETE_FAILED" _delta="define">
<description>A check has failed, it is not possible to delete the object</description>
<sources>
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
</sources>
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
<event_data>
<event_datum id="check_issues">
<description>Array of the issues (string) that prevented the object deletion</description>
<type>array</type>
</event_datum>
<event_datum id="object">
<description>The object to check</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_DB_DELETE_DONE" _delta="define">
<description>An object has been deleted into the database</description>
<sources>

View File

@@ -2373,7 +2373,6 @@ abstract class DBObject implements iDisplay
else
{
$this->m_bCheckStatus = false;
$this->EventCheckToWriteFailed($this->m_aCheckIssues);
}
}
return array($this->m_bCheckStatus, $this->m_aCheckIssues, $this->m_bSecurityIssue);
@@ -3756,8 +3755,7 @@ abstract class DBObject implements iDisplay
if ($oDeletionPlan->FoundStopper())
{
$aIssues = $oDeletionPlan->GetIssues();
$this->EventCheckToDeleteFailed($aIssues);
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
}
@@ -5899,14 +5897,6 @@ abstract class DBObject implements iDisplay
{
}
/**
* @return void
* @since 3.1.0
*/
protected function EventCheckToWriteFailed(array $aIssues): void
{
}
/**
* @return void
* @since 3.1.0
@@ -5939,14 +5929,6 @@ abstract class DBObject implements iDisplay
{
}
/**
* @return void
* @since 3.1.0
*/
protected function EventCheckToDeleteFailed(array $aIssues): void
{
}
/**
* @return void
* @since 3.1.0