@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PholioTransactionComment
4 extends PhabricatorApplicationTransactionComment {
5
6 protected $imageID;
7 protected $x;
8 protected $y;
9 protected $width;
10 protected $height;
11 protected $content;
12
13 public function getApplicationTransactionObject() {
14 return new PholioTransaction();
15 }
16
17 protected function getConfiguration() {
18 $config = parent::getConfiguration();
19
20 $config[self::CONFIG_COLUMN_SCHEMA] = array(
21 'imageID' => 'id?',
22 'x' => 'uint32?',
23 'y' => 'uint32?',
24 'width' => 'uint32?',
25 'height' => 'uint32?',
26 ) + $config[self::CONFIG_COLUMN_SCHEMA];
27
28 $config[self::CONFIG_KEY_SCHEMA] = array(
29 'key_draft' => array(
30 'columns' => array('authorPHID', 'imageID', 'transactionPHID'),
31 'unique' => true,
32 ),
33 ) + $config[self::CONFIG_KEY_SCHEMA];
34
35 return $config;
36 }
37
38 public function toDictionary() {
39 return array(
40 'id' => $this->getID(),
41 'phid' => $this->getPHID(),
42 'transactionPHID' => $this->getTransactionPHID(),
43 'x' => $this->getX(),
44 'y' => $this->getY(),
45 'width' => $this->getWidth(),
46 'height' => $this->getHeight(),
47 );
48 }
49
50 public function shouldUseMarkupCache($field) {
51 // Only cache submitted comments.
52 return ($this->getTransactionPHID() != null);
53 }
54
55}