Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/storage/PholioMock.php
Show All 19 Lines | final class PholioMock extends PholioDAO | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $name; | protected $name; | ||||
protected $description; | protected $description; | ||||
protected $coverPHID; | protected $coverPHID; | ||||
protected $mailKey; | |||||
protected $status; | protected $status; | ||||
protected $spacePHID; | protected $spacePHID; | ||||
private $images = self::ATTACHABLE; | private $images = self::ATTACHABLE; | ||||
private $coverFile = self::ATTACHABLE; | private $coverFile = self::ATTACHABLE; | ||||
private $tokenCount = self::ATTACHABLE; | private $tokenCount = self::ATTACHABLE; | ||||
public static function initializeNewMock(PhabricatorUser $actor) { | public static function initializeNewMock(PhabricatorUser $actor) { | ||||
Show All 23 Lines | final class PholioMock extends PholioDAO | ||||
} | } | ||||
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( | ||||
'name' => 'text128', | 'name' => 'text128', | ||||
'description' => 'text', | 'description' => 'text', | ||||
'mailKey' => 'bytes20', | |||||
'status' => 'text12', | 'status' => 'text12', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'key_phid' => null, | |||||
'phid' => array( | |||||
'columns' => array('phid'), | |||||
'unique' => true, | |||||
), | |||||
'authorPHID' => array( | 'authorPHID' => array( | ||||
'columns' => array('authorPHID'), | 'columns' => array('authorPHID'), | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | public function getPHIDType() { | ||||
return PhabricatorPHID::generateNewPHID('MOCK'); | return PholioMockPHIDType::TYPECONST; | ||||
} | |||||
public function save() { | |||||
if (!$this->getMailKey()) { | |||||
$this->setMailKey(Filesystem::readRandomCharacters(20)); | |||||
} | |||||
return parent::save(); | |||||
} | } | ||||
public function attachImages(array $images) { | public function attachImages(array $images) { | ||||
assert_instances_of($images, 'PholioImage'); | assert_instances_of($images, 'PholioImage'); | ||||
$images = mpull($images, null, 'getPHID'); | $images = mpull($images, null, 'getPHID'); | ||||
$images = msort($images, 'getSequence'); | $images = msort($images, 'getSequence'); | ||||
$this->images = $images; | $this->images = $images; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |