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:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
final class PhabricatorFileHasObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 26;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user