Permalink
Browse files

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
  • Loading branch information...
1 parent 5320d85 commit 6115756e9d78268974db4320ad2262353bf0b66e @champo champo committed with epriestley Mar 26, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
@@ -33,7 +33,8 @@
/**
* 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 @@ private function executeAdds() {
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));
}

0 comments on commit 6115756

Please sign in to comment.