Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/storage/PhabricatorFile.php
Show First 20 Lines • Show All 1,410 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Write the policy edge between this file and some object. | * Write the policy edge between this file and some object. | ||||
* | * | ||||
* @param phid Object PHID to attach to. | * @param phid Object PHID to attach to. | ||||
* @return this | * @return this | ||||
*/ | */ | ||||
public function attachToObject($phid) { | public function attachToObject($phid) { | ||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST; | |||||
id(new PhabricatorEdgeEditor()) | |||||
->addEdge($phid, $edge_type, $this->getPHID()) | |||||
->save(); | |||||
$attachment_table = new PhabricatorFileAttachment(); | $attachment_table = new PhabricatorFileAttachment(); | ||||
$attachment_conn = $attachment_table->establishConnection('w'); | $attachment_conn = $attachment_table->establishConnection('w'); | ||||
queryfx( | queryfx( | ||||
$attachment_conn, | $attachment_conn, | ||||
'INSERT INTO %R (objectPHID, filePHID, attachmentMode, | 'INSERT INTO %R (objectPHID, filePHID, attachmentMode, | ||||
attacherPHID, dateCreated, dateModified) | attacherPHID, dateCreated, dateModified) | ||||
VALUES (%s, %s, %s, %ns, %d, %d) | VALUES (%s, %s, %s, %ns, %d, %d) | ||||
▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines |