Modernize remaining edge types

Summary: Modernize remaining edges to subclass `PhabricatorEdgeType`. Largely based on D11045.

Test Plan: Browsed around and performed various actions include subscribing, unsubscribing and watching.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11116
This commit is contained in:
Joshua Spence
2015-01-03 10:33:25 +11:00
parent d0d1866103
commit 7c2a7d0365
58 changed files with 824 additions and 421 deletions

View File

@@ -0,0 +1,15 @@
<?php
final class PhabricatorFileHasObjectEdgeType extends PhabricatorEdgeType {
const EDGECONST = 26;
public function getInverseEdgeConstant() {
return PhabricatorObjectHasFileEdgeType::EDGECONST;
}
public function shouldWriteInverseTransactions() {
return true;
}
}

View File

@@ -116,7 +116,7 @@ final class PhabricatorFileQuery
// We need to load attached objects to perform policy checks for files.
// First, load the edges.
$edge_type = PhabricatorEdgeConfig::TYPE_FILE_HAS_OBJECT;
$edge_type = PhabricatorFileHasObjectEdgeType::EDGECONST;
$file_phids = mpull($files, 'getPHID');
$edges = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($file_phids)

View File

@@ -991,7 +991,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
* @return this
*/
public function attachToObject($phid) {
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
id(new PhabricatorEdgeEditor())
->addEdge($phid, $edge_type, $this->getPHID())
@@ -1008,7 +1008,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
* @return this
*/
public function detachFromObject($phid) {
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
id(new PhabricatorEdgeEditor())
->removeEdge($phid, $edge_type, $this->getPHID())