mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
N°6043 - Booking: Add prerequisites in iTop core - CRUD extensibility (#520)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace Combodo\iTop\Service\Base;
|
||||
|
||||
use cmdbAbstractObject;
|
||||
use Combodo\iTop\Core\MetaModel\FriendlyNameType;
|
||||
use DBObject;
|
||||
use DBObjectSearch;
|
||||
@@ -299,4 +300,40 @@ class ObjectRepository
|
||||
return ObjectRepository::ComputeOthersData($oObject, $sObjectClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DeleteFromOql.
|
||||
*
|
||||
* @param string $sOql OQL expression
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static public function DeleteFromOql(string $sOql): bool
|
||||
{
|
||||
try {
|
||||
|
||||
// Create db search
|
||||
$oDbObjectSearch = DBSearch::FromOQL($sOql);
|
||||
|
||||
// Create db set from db search
|
||||
$oDbObjectSet = new DBObjectSet($oDbObjectSearch);
|
||||
|
||||
// Delete objects
|
||||
while ($oObject = $oDbObjectSet->Fetch()) {
|
||||
$oObject->DBDelete();
|
||||
}
|
||||
|
||||
// return operation success
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
|
||||
ExceptionLog::LogException($e);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user