From 6115756e9d78268974db4320ad2262353bf0b66e Mon Sep 17 00:00:00 2001 From: Juan Pablo Civile Date: Tue, 26 Mar 2013 13:08:46 -0700 Subject: [PATCH] API for editing edge data Summary: Add the ``PhabricatorEdgeDataEditor`` that allows you to edit the data attached to an edge and its inverse. Test Plan: Create several edges and update the data attached. Once duplicating the data on both the edge and its inverse, and once setting different value for both. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1279 Differential Revision: https://secure.phabricator.com/D5447 --- src/infrastructure/edges/editor/PhabricatorEdgeEditor.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php index f869a2e019..edda35cf0f 100644 --- a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php +++ b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php @@ -33,7 +33,8 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { /** * Add a new edge (possibly also adding its inverse). Changes take effect when * you call @{method:save}. If the edge already exists, it will not be - * overwritten. Removals queued with @{method:removeEdge} are executed before + * overwritten, but if data is attached to the edge it will be updated. + * Removals queued with @{method:removeEdge} are executed before * adds, so the effect of removing and adding the same edge is to overwrite * any existing edge. * @@ -280,8 +281,8 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { foreach (array_chunk($sql, 256) as $chunk) { queryfx( $conn_w, - 'INSERT IGNORE INTO %T (src, type, dst, dateCreated, seq, dataID) - VALUES %Q', + 'INSERT INTO %T (src, type, dst, dateCreated, seq, dataID) + VALUES %Q ON DUPLICATE KEY UPDATE dataID = VALUES(dataID)', PhabricatorEdgeConfig::TABLE_NAME_EDGE, implode(', ', $chunk)); }