Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / flag / storage / PhabricatorFlag.php
blob697af08f1476d9fcf0de231edcd171da94107eeb
1 <?php
3 final class PhabricatorFlag extends PhabricatorFlagDAO
4 implements PhabricatorPolicyInterface {
6 protected $ownerPHID;
7 protected $type;
8 protected $objectPHID;
9 protected $reasonPHID;
10 protected $color = PhabricatorFlagColor::COLOR_BLUE;
11 protected $note;
13 private $handle = self::ATTACHABLE;
14 private $object = self::ATTACHABLE;
16 protected function getConfiguration() {
17 return array(
18 self::CONFIG_COLUMN_SCHEMA => array(
19 'type' => 'text4',
20 'color' => 'uint32',
21 'note' => 'text',
23 self::CONFIG_KEY_SCHEMA => array(
24 'ownerPHID' => array(
25 'columns' => array('ownerPHID', 'type', 'objectPHID'),
26 'unique' => true,
28 'objectPHID' => array(
29 'columns' => array('objectPHID'),
32 ) + parent::getConfiguration();
35 public function getObject() {
36 return $this->assertAttached($this->object);
39 public function attachObject($object) {
40 $this->object = $object;
41 return $this;
44 public function getHandle() {
45 return $this->assertAttached($this->handle);
48 public function attachHandle(PhabricatorObjectHandle $handle) {
49 $this->handle = $handle;
50 return $this;
54 /* -( PhabricatorPolicyInterface )----------------------------------------- */
57 public function getCapabilities() {
58 return array(
59 PhabricatorPolicyCapability::CAN_VIEW,
60 PhabricatorPolicyCapability::CAN_EDIT,
64 public function getPolicy($capability) {
65 return PhabricatorPolicies::POLICY_NOONE;
68 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
69 return ($viewer->getPHID() == $this->getOwnerPHID());
72 public function describeAutomaticCapability($capability) {
73 return pht('Flags are private. Only you can view or edit your flags.');