Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/storage/PhortuneMerchant.php
<?php | <?php | ||||
final class PhortuneMerchant extends PhortuneDAO | final class PhortuneMerchant extends PhortuneDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorPolicyInterface { | PhabricatorPolicyInterface { | ||||
protected $name; | protected $name; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $description; | protected $description; | ||||
protected $contactInfo; | protected $contactInfo; | ||||
protected $profileImagePHID; | |||||
private $memberPHIDs = self::ATTACHABLE; | private $memberPHIDs = self::ATTACHABLE; | ||||
private $profileImageFile = self::ATTACHABLE; | |||||
public static function initializeNewMerchant(PhabricatorUser $actor) { | public static function initializeNewMerchant(PhabricatorUser $actor) { | ||||
return id(new PhortuneMerchant()) | return id(new PhortuneMerchant()) | ||||
->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) | ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) | ||||
->attachMemberPHIDs(array()); | ->attachMemberPHIDs(array()); | ||||
} | } | ||||
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' => 'text255', | 'name' => 'text255', | ||||
'description' => 'text', | 'description' => 'text', | ||||
'contactInfo' => 'text', | 'contactInfo' => 'text', | ||||
'profileImagePHID' => 'phid?', | |||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | public function generatePHID() { | ||||
return PhabricatorPHID::generateNewPHID( | return PhabricatorPHID::generateNewPHID( | ||||
PhortuneMerchantPHIDType::TYPECONST); | PhortuneMerchantPHIDType::TYPECONST); | ||||
} | } | ||||
public function getMemberPHIDs() { | public function getMemberPHIDs() { | ||||
return $this->assertAttached($this->memberPHIDs); | return $this->assertAttached($this->memberPHIDs); | ||||
} | } | ||||
public function attachMemberPHIDs(array $member_phids) { | public function attachMemberPHIDs(array $member_phids) { | ||||
$this->memberPHIDs = $member_phids; | $this->memberPHIDs = $member_phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getViewURI() { | |||||
return '/phortune/merchant/'.$this->getID().'/'; | |||||
} | |||||
public function getProfileImageURI() { | |||||
return $this->getProfileImageFile()->getBestURI(); | |||||
} | |||||
public function attachProfileImageFile(PhabricatorFile $file) { | |||||
$this->profileImageFile = $file; | |||||
return $this; | |||||
} | |||||
public function getProfileImageFile() { | |||||
return $this->assertAttached($this->profileImageFile); | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new PhortuneMerchantEditor(); | return new PhortuneMerchantEditor(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |