Skip to content

Commit d74573e

Browse files
committed
N°8210 - Remove iApplicationObjectExtension
1 parent 965c9db commit d74573e

File tree

12 files changed

+18
-570
lines changed

12 files changed

+18
-570
lines changed

application/applicationextension.inc.php

Lines changed: 0 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -553,173 +553,6 @@ public function EnumAllowedActions(DBObjectSet $oSet)
553553

554554
}
555555

556-
/**
557-
* Implement this interface to perform specific operations when objects are manipulated
558-
*
559-
* Note that those methods will be called when objects are manipulated, either in a programmatic way
560-
* or through the GUI.
561-
*
562-
* @api
563-
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method. More details on each method PHPDoc.
564-
* @package ORMExtensibilityAPI
565-
*/
566-
interface iApplicationObjectExtension
567-
{
568-
/**
569-
* Invoked to determine whether an object has been modified in memory
570-
*
571-
* The GUI calls this verb to determine the message that will be displayed to the end-user.
572-
* Anyhow, this API can be called in other contexts such as the CSV import tool.
573-
*
574-
* If the extension returns false, then the framework will perform the usual evaluation.
575-
* Otherwise, the answer is definitively "yes, the object has changed".
576-
*
577-
* @api
578-
* @deprecated 3.1.0 N°4756 No alternative available, this API was unstable and is abandoned
579-
* @param \cmdbAbstractObject $oObject The target object
580-
*
581-
* @return boolean True if something has changed for the target object
582-
*/
583-
public function OnIsModified($oObject);
584-
585-
/**
586-
* Invoked to determine whether an object can be written to the database
587-
*
588-
* The GUI calls this verb and reports any issue.
589-
* Anyhow, this API can be called in other contexts such as the CSV import tool.
590-
*
591-
* @api
592-
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_WRITE event instead
593-
* @param \cmdbAbstractObject $oObject The target object
594-
*
595-
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
596-
*/
597-
public function OnCheckToWrite($oObject);
598-
599-
/**
600-
* Invoked to determine wether an object can be deleted from the database
601-
*
602-
* The GUI calls this verb and stops the deletion process if any issue is reported.
603-
*
604-
* Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.
605-
*
606-
* @api
607-
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_DELETE event instead
608-
* @param \cmdbAbstractObject $oObject The target object
609-
*
610-
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
611-
*/
612-
public function OnCheckToDelete($oObject);
613-
614-
/**
615-
* Invoked when an object is updated into the database. The method is called right <b>after</b> the object has been written to the
616-
* database.
617-
*
618-
* Useful methods you can call on $oObject :
619-
*
620-
* * {@see DBObject::ListPreviousValuesForUpdatedAttributes()} : list of changed attributes and their values before the change
621-
* * {@see DBObject::Get()} : for a given attribute the new value that was persisted
622-
*
623-
* @api
624-
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
625-
* @param \cmdbAbstractObject $oObject The target object
626-
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
627-
* once for all the changes made within the current page
628-
*
629-
* @return void
630-
*
631-
* @since 2.7.0 N°2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} on $oObject
632-
*/
633-
public function OnDBUpdate($oObject, $oChange = null);
634-
635-
/**
636-
* Invoked when an object is created into the database
637-
*
638-
* The method is called right <b>after</b> the object has been written to the database.
639-
*
640-
* @api
641-
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
642-
* @param \cmdbAbstractObject $oObject The target object
643-
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
644-
* once for all the changes made within the current page
645-
*
646-
* @return void
647-
*/
648-
public function OnDBInsert($oObject, $oChange = null);
649-
650-
/**
651-
* Invoked when an object is deleted from the database
652-
*
653-
* The method is called right <b>before</b> the object will be deleted from the database.
654-
*
655-
* @api
656-
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_DELETE event instead
657-
* @param \cmdbAbstractObject $oObject The target object
658-
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
659-
* once for all the changes made within the current page
660-
*
661-
* @return void
662-
*/
663-
public function OnDBDelete($oObject, $oChange = null);
664-
}
665-
666-
/**
667-
* Extend this class instead of iApplicationObjectExtension if you don't need to overload all methods
668-
*
669-
* @api
670-
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method
671-
* @package ORMExtensibilityAPI
672-
* @since 2.7.0
673-
*/
674-
abstract class AbstractApplicationObjectExtension implements iApplicationObjectExtension
675-
{
676-
/**
677-
* @inheritDoc
678-
*/
679-
public function OnIsModified($oObject)
680-
{
681-
return false;
682-
}
683-
684-
/**
685-
* @inheritDoc
686-
*/
687-
public function OnCheckToWrite($oObject)
688-
{
689-
return array();
690-
}
691-
692-
/**
693-
* @inheritDoc
694-
*/
695-
public function OnCheckToDelete($oObject)
696-
{
697-
return array();
698-
}
699-
700-
/**
701-
* @inheritDoc
702-
*/
703-
public function OnDBUpdate($oObject, $oChange = null)
704-
{
705-
}
706-
707-
/**
708-
* @inheritDoc
709-
*/
710-
public function OnDBInsert($oObject, $oChange = null)
711-
{
712-
}
713-
714-
/**
715-
* @inheritDoc
716-
*/
717-
public function OnDBDelete($oObject, $oChange = null)
718-
{
719-
}
720-
721-
}
722-
723556
/**
724557
* New extension to add menu items in the "popup" menus inside iTop. Provides a greater flexibility than
725558
* iApplicationUIExtension::EnumAllowedActions.

application/cmdbabstract.class.inc.php

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -4542,21 +4542,6 @@ public function DBInsertNoReload()
45424542
return $res;
45434543
}
45444544

4545-
protected function PostInsertActions(): void
4546-
{
4547-
parent::PostInsertActions();
4548-
4549-
// Invoke extensions after insertion (the object must exist, have an id, etc.)
4550-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4551-
foreach (MetaModel::EnumPlugins(iApplicationObjectExtension::class) as $oExtensionInstance) {
4552-
$sExtensionClass = get_class($oExtensionInstance);
4553-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBInsert()");
4554-
$oKPI = new ExecutionKPI();
4555-
$oExtensionInstance->OnDBInsert($this, self::GetCurrentChange());
4556-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBInsert');
4557-
}
4558-
}
4559-
45604545
/**
45614546
* @inheritdoc
45624547
* Attaches InlineImages to the current object
@@ -4589,21 +4574,6 @@ public function DBUpdate()
45894574
return $res;
45904575
}
45914576

4592-
protected function PostUpdateActions(array $aChanges): void
4593-
{
4594-
parent::PostUpdateActions($aChanges);
4595-
4596-
// Invoke extensions after the update (could be before)
4597-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4598-
foreach (MetaModel::EnumPlugins(iApplicationObjectExtension::class) as $oExtensionInstance) {
4599-
$sExtensionClass = get_class($oExtensionInstance);
4600-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBUpdate()");
4601-
$oKPI = new ExecutionKPI();
4602-
$oExtensionInstance->OnDBUpdate($this, self::GetCurrentChange());
4603-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBUpdate');
4604-
}
4605-
}
4606-
46074577
/**
46084578
* @param string $sMessageIdPrefix
46094579
*
@@ -4639,21 +4609,6 @@ public function DBDelete(&$oDeletionPlan = null)
46394609
return $oDeletionPlan;
46404610
}
46414611

4642-
final protected function PreDeleteActions(): void
4643-
{
4644-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4645-
foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
4646-
{
4647-
$sExtensionClass = get_class($oExtensionInstance);
4648-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnDBDelete()");
4649-
$oKPI = new ExecutionKPI();
4650-
$oExtensionInstance->OnDBDelete($this, self::GetCurrentChange());
4651-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnDBDelete');
4652-
}
4653-
4654-
parent::PreDeleteActions();
4655-
}
4656-
46574612
final protected function PostDeleteActions(): void
46584613
{
46594614
parent::PostDeleteActions();
@@ -4666,24 +4621,6 @@ public function IsModified()
46664621
return true;
46674622
}
46684623

4669-
// Plugins
4670-
//
4671-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4672-
foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
4673-
{
4674-
$sExtensionClass = get_class($oExtensionInstance);
4675-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnIsModified()");
4676-
$oKPI = new ExecutionKPI();
4677-
$bIsModified = $oExtensionInstance->OnIsModified($this);
4678-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnIsModified');
4679-
if ($bIsModified) {
4680-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnIsModified() -> true");
4681-
return true;
4682-
} else {
4683-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnIsModified() -> false");
4684-
}
4685-
}
4686-
46874624
return false;
46884625
}
46894626

@@ -4698,7 +4635,7 @@ public function AllowWrite($bAllow = true)
46984635
}
46994636

47004637
/**
4701-
* Whether to bypass the checks of user rights when writing this object, could be used in {@link \iApplicationObjectExtension::OnCheckToWrite()}
4638+
* Whether to bypass the checks of user rights when writing this object
47024639
*
47034640
* @return bool
47044641
*/
@@ -4727,22 +4664,6 @@ public function DoCheckToWrite()
47274664
{
47284665
parent::DoCheckToWrite();
47294666

4730-
// Plugins
4731-
//
4732-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4733-
foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
4734-
{
4735-
$sExtensionClass = get_class($oExtensionInstance);
4736-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnCheckToWrite()");
4737-
$oKPI = new ExecutionKPI();
4738-
$aNewIssues = $oExtensionInstance->OnCheckToWrite($this);
4739-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToWrite');
4740-
if (is_array($aNewIssues) && (count($aNewIssues) > 0)) // Some extensions return null instead of an empty array
4741-
{
4742-
$this->m_aCheckIssues = array_merge($this->m_aCheckIssues, $aNewIssues);
4743-
}
4744-
}
4745-
47464667
// User rights
47474668
//
47484669
if (!$this->bAllowWrite)
@@ -4779,22 +4700,6 @@ protected function DoCheckToDelete(&$oDeletionPlan)
47794700
{
47804701
parent::DoCheckToDelete($oDeletionPlan);
47814702

4782-
// Plugins
4783-
//
4784-
/** @var \iApplicationObjectExtension $oExtensionInstance */
4785-
foreach(MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance)
4786-
{
4787-
$sExtensionClass = get_class($oExtensionInstance);
4788-
$this->LogCRUDDebug(__METHOD__, "Calling $sExtensionClass::OnCheckToDelete()");
4789-
$oKPI = new ExecutionKPI();
4790-
$aNewIssues = $oExtensionInstance->OnCheckToDelete($this);
4791-
$oKPI->ComputeStatsForExtension($oExtensionInstance, 'OnCheckToDelete');
4792-
if (is_array($aNewIssues) && count($aNewIssues) > 0)
4793-
{
4794-
$this->m_aDeleteIssues = array_merge($this->m_aDeleteIssues, $aNewIssues);
4795-
}
4796-
}
4797-
47984703
// User rights
47994704
//
48004705
if (! $this->bAllowDelete)

core/metamodel.class.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7709,7 +7709,6 @@ public static function InitExtensions()
77097709
'iLoginUIExtension',
77107710
'iPreferencesExtension',
77117711
'iApplicationUIExtension',
7712-
'iApplicationObjectExtension',
77137712
'iPopupMenuExtension',
77147713
'iPageUIBlockExtension',
77157714
'iBackofficeLinkedScriptsExtension',

0 commit comments

Comments
 (0)