|
|
|
@ -129,19 +129,82 @@ switch ($action) { |
|
|
|
|
if ($sequenceResource->getSequence()->hasGraph()) { |
|
|
|
|
$graph = $sequenceResource->getSequence()->getUnSerializeGraph(); |
|
|
|
|
if ($graph->hasVertex($vertexId)) { |
|
|
|
|
$vertex = $graph->getVertex($vertexId); |
|
|
|
|
$vertex->destroy(); |
|
|
|
|
|
|
|
|
|
/** @var SequenceResource $sequenceResource */ |
|
|
|
|
$sequenceResourceToDelete = $repository->findOneBy( |
|
|
|
|
[ |
|
|
|
|
'resourceId' => $vertexId, |
|
|
|
|
'type' => $type, |
|
|
|
|
'sequence' => $sequence |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
$edgeIterator = $graph->getEdges()->getIterator(); |
|
|
|
|
$edgeToDelete = null; |
|
|
|
|
foreach ($edgeIterator as $edge) { |
|
|
|
|
if ($edge->getVertexStart()->getId() == $vertexId && $edge->getVertexEnd()->getId() == $id) { |
|
|
|
|
$edgeToDelete = $edge; |
|
|
|
|
$vertexFromTo = null; |
|
|
|
|
$vertexToFrom = null; |
|
|
|
|
foreach ($edgeIterator as $edges) { |
|
|
|
|
if (intval($edges->getVertexEnd()->getId()) === intval($id)) { |
|
|
|
|
$vertexFromTo = $edges; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (intval($edges->getVertexStart()->getId()) === intval($vertexId)) { |
|
|
|
|
$vertexToFrom = $edges; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($vertexFromTo && !$vertexToFrom) { |
|
|
|
|
$_SESSION['sr_vertex'] = true; |
|
|
|
|
$vertex = $graph->getVertex($id); |
|
|
|
|
$vertex->destroy(); |
|
|
|
|
$em->remove($sequenceResource); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($vertexToFrom && $vertexFromTo) { |
|
|
|
|
$vertex = $graph->getVertex($vertexId); |
|
|
|
|
$edgeToDelete->destroy(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($vertexToFrom && !$vertexFromTo) { |
|
|
|
|
$vertex = $graph->getVertex($vertexId); |
|
|
|
|
$vertex->destroy(); |
|
|
|
|
$sequenceResourceToDelete = $repository->findOneBy( |
|
|
|
|
[ |
|
|
|
|
'resourceId' => $vertexId, |
|
|
|
|
'type' => $type, |
|
|
|
|
'sequence' => $sequence |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
$em->remove($sequenceResourceToDelete); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$em->remove($sequenceResourceToDelete); |
|
|
|
|
if (!$vertexToFrom && !$vertexFromTo) { |
|
|
|
|
$_SESSION['sr_vertex'] = true; |
|
|
|
|
$vertexTo = $graph->getVertex($id); |
|
|
|
|
$vertexFrom = $graph->getVertex($vertexId); |
|
|
|
|
if ($vertexTo->getVerticesEdgeFrom()->count() > 1) { |
|
|
|
|
$vertexFrom->destroy(); |
|
|
|
|
$sequenceResourceToDelete = $repository->findOneBy( |
|
|
|
|
[ |
|
|
|
|
'resourceId' => $vertexId, |
|
|
|
|
'type' => $type, |
|
|
|
|
'sequence' => $sequence |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
$em->remove($sequenceResourceToDelete); |
|
|
|
|
} else { |
|
|
|
|
$vertexTo->destroy(); |
|
|
|
|
$vertexFrom->destroy(); |
|
|
|
|
$sequenceResourceToDelete = $repository->findOneBy( |
|
|
|
|
[ |
|
|
|
|
'resourceId' => $vertexId, |
|
|
|
|
'type' => $type, |
|
|
|
|
'sequence' => $sequence |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
$em->remove($sequenceResource); |
|
|
|
|
$em->remove($sequenceResourceToDelete); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sequence->setGraphAndSerialize($graph); |
|
|
|
|
$em->merge($sequence); |
|
|
|
@ -226,6 +289,12 @@ switch ($action) { |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($_SESSION['sr_vertex']) && $_SESSION['sr_vertex']) { |
|
|
|
|
unset($_SESSION['sr_vertex']); |
|
|
|
|
echo Display::return_message(get_lang('Saved'), 'success'); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parents = str_replace($id, '', $parents); |
|
|
|
|
$parents = explode(',', $parents); |
|
|
|
|
$parents = array_filter($parents); |
|
|
|
|