Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/storage/PholioImage.php
<?php | <?php | ||||
final class PholioImage extends PholioDAO | final class PholioImage extends PholioDAO | ||||
implements | implements | ||||
PhabricatorMarkupInterface, | PhabricatorMarkupInterface, | ||||
PhabricatorPolicyInterface { | PhabricatorPolicyInterface { | ||||
const MARKUP_FIELD_DESCRIPTION = 'markup:description'; | const MARKUP_FIELD_DESCRIPTION = 'markup:description'; | ||||
protected $mockID; | protected $mockID; | ||||
protected $filePHID; | protected $filePHID; | ||||
protected $name = ''; | protected $name; | ||||
protected $description = ''; | protected $description; | ||||
protected $sequence; | protected $sequence; | ||||
protected $isObsolete = 0; | protected $isObsolete; | ||||
protected $replacesImagePHID = null; | protected $replacesImagePHID = null; | ||||
private $inlineComments = self::ATTACHABLE; | private $inlineComments = self::ATTACHABLE; | ||||
private $file = self::ATTACHABLE; | private $file = self::ATTACHABLE; | ||||
private $mock = self::ATTACHABLE; | private $mock = self::ATTACHABLE; | ||||
public static function initializeNewImage() { | |||||
return id(new self()) | |||||
->setName('') | |||||
->setDescription('') | |||||
->setIsObsolete(0); | |||||
} | |||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'mockID' => 'id?', | 'mockID' => 'id?', | ||||
'name' => 'text128', | 'name' => 'text128', | ||||
'description' => 'text', | 'description' => 'text', | ||||
'sequence' => 'uint32', | 'sequence' => 'uint32', | ||||
'isObsolete' => 'bool', | 'isObsolete' => 'bool', | ||||
'replacesImagePHID' => 'phid?', | 'replacesImagePHID' => 'phid?', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'key_phid' => null, | 'key_phid' => null, | ||||
'keyPHID' => array( | 'keyPHID' => array( | ||||
'columns' => array('phid'), | 'columns' => array('phid'), | ||||
'unique' => true, | 'unique' => true, | ||||
), | ), | ||||
'mockID' => array( | 'mockID' => array( | ||||
'columns' => array('mockID', 'isObsolete', 'sequence'), | 'columns' => array('mockID', 'isObsolete', 'sequence'), | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | public function getPHIDType() { | ||||
return PhabricatorPHID::generateNewPHID(PholioImagePHIDType::TYPECONST); | return PholioImagePHIDType::TYPECONST; | ||||
} | } | ||||
public function attachFile(PhabricatorFile $file) { | public function attachFile(PhabricatorFile $file) { | ||||
$this->file = $file; | $this->file = $file; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getFile() { | public function getFile() { | ||||
$this->assertAttached($this->file); | $this->assertAttached($this->file); | ||||
return $this->file; | return $this->file; | ||||
} | } | ||||
public function attachMock(PholioMock $mock) { | public function attachMock(PholioMock $mock) { | ||||
$this->mock = $mock; | $this->mock = $mock; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getMock() { | public function getMock() { | ||||
$this->assertAttached($this->mock); | $this->assertAttached($this->mock); | ||||
return $this->mock; | return $this->mock; | ||||
} | } | ||||
public function attachInlineComments(array $inline_comments) { | public function attachInlineComments(array $inline_comments) { | ||||
assert_instances_of($inline_comments, 'PholioTransactionComment'); | assert_instances_of($inline_comments, 'PholioTransactionComment'); | ||||
$this->inlineComments = $inline_comments; | $this->inlineComments = $inline_comments; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getInlineComments() { | public function getInlineComments() { | ||||
$this->assertAttached($this->inlineComments); | $this->assertAttached($this->inlineComments); | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |