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
This commit is contained in:
committed by
epriestley
parent
5320d85343
commit
6115756e9d
@@ -33,7 +33,8 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor {
|
|||||||
/**
|
/**
|
||||||
* Add a new edge (possibly also adding its inverse). Changes take effect when
|
* 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
|
* 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
|
* adds, so the effect of removing and adding the same edge is to overwrite
|
||||||
* any existing edge.
|
* any existing edge.
|
||||||
*
|
*
|
||||||
@@ -280,8 +281,8 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor {
|
|||||||
foreach (array_chunk($sql, 256) as $chunk) {
|
foreach (array_chunk($sql, 256) as $chunk) {
|
||||||
queryfx(
|
queryfx(
|
||||||
$conn_w,
|
$conn_w,
|
||||||
'INSERT IGNORE INTO %T (src, type, dst, dateCreated, seq, dataID)
|
'INSERT INTO %T (src, type, dst, dateCreated, seq, dataID)
|
||||||
VALUES %Q',
|
VALUES %Q ON DUPLICATE KEY UPDATE dataID = VALUES(dataID)',
|
||||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||||
implode(', ', $chunk));
|
implode(', ', $chunk));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user