Model factory: introduced a new variation of attribute _delta: delete_if_exists. Use this flag to delete a branch from the data model being hacked, without caring if it is already deleted (or non existing). This eases the burden of coping with different installation combinations.

SVN:trunk[4306]
This commit is contained in:
Denis Flaven
2016-07-15 06:41:26 +00:00
parent 109e5dfe2c
commit 2c78a91a00

View File

@@ -490,7 +490,17 @@ class ModelFactory
$oTargetParentNode->RedefineChildNode($oTargetNode, $sSearchId);
break;
case 'delete':
case 'delete_if_exists':
$oTargetNode = $oTargetParentNode->_FindChildNode($oSourceNode);
if (($oTargetNode !== null) && ($oTargetNode->getAttribute('_alteration') !== 'removed'))
{
// Delete the node if it actually exists and is not already marked as deleted
$oTargetNode->Delete();
}
// otherwise fail silently
break;
case 'delete':
$oTargetNode = $oTargetParentNode->_FindChildNode($oSourceNode);
if ($oTargetNode == null)
{