Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/storage/PhamePost.php
Show All 20 Lines | final class PhamePost extends PhameDAO | ||||
protected $subtitle; | protected $subtitle; | ||||
protected $phameTitle; | protected $phameTitle; | ||||
protected $body; | protected $body; | ||||
protected $visibility; | protected $visibility; | ||||
protected $configData; | protected $configData; | ||||
protected $datePublished; | protected $datePublished; | ||||
protected $blogPHID; | protected $blogPHID; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $headerImagePHID; | |||||
private $blog = self::ATTACHABLE; | private $blog = self::ATTACHABLE; | ||||
private $headerImageFile = self::ATTACHABLE; | |||||
public static function initializePost( | public static function initializePost( | ||||
PhabricatorUser $blogger, | PhabricatorUser $blogger, | ||||
PhameBlog $blog) { | PhameBlog $blog) { | ||||
$post = id(new PhamePost()) | $post = id(new PhamePost()) | ||||
->setBloggerPHID($blogger->getPHID()) | ->setBloggerPHID($blogger->getPHID()) | ||||
->setBlogPHID($blog->getPHID()) | ->setBlogPHID($blog->getPHID()) | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | return array( | ||||
'configData' => self::SERIALIZATION_JSON, | 'configData' => self::SERIALIZATION_JSON, | ||||
), | ), | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'title' => 'text255', | 'title' => 'text255', | ||||
'subtitle' => 'text64', | 'subtitle' => 'text64', | ||||
'phameTitle' => 'sort64?', | 'phameTitle' => 'sort64?', | ||||
'visibility' => 'uint32', | 'visibility' => 'uint32', | ||||
'mailKey' => 'bytes20', | 'mailKey' => 'bytes20', | ||||
'headerImagePHID' => 'phid?', | |||||
// T6203/NULLABILITY | // T6203/NULLABILITY | ||||
// These seem like they should always be non-null? | // These seem like they should always be non-null? | ||||
'blogPHID' => 'phid?', | 'blogPHID' => 'phid?', | ||||
'body' => 'text?', | 'body' => 'text?', | ||||
'configData' => 'text?', | 'configData' => 'text?', | ||||
// T6203/NULLABILITY | // T6203/NULLABILITY | ||||
Show All 29 Lines | public function generatePHID() { | ||||
return PhabricatorPHID::generateNewPHID( | return PhabricatorPHID::generateNewPHID( | ||||
PhabricatorPhamePostPHIDType::TYPECONST); | PhabricatorPhamePostPHIDType::TYPECONST); | ||||
} | } | ||||
public function getSlug() { | public function getSlug() { | ||||
return PhabricatorSlug::normalizeProjectSlug($this->getTitle(), true); | return PhabricatorSlug::normalizeProjectSlug($this->getTitle(), true); | ||||
} | } | ||||
public function getHeaderImageURI() { | |||||
return $this->getHeaderImageFile()->getBestURI(); | |||||
} | |||||
public function attachHeaderImageFile(PhabricatorFile $file) { | |||||
$this->headerImageFile = $file; | |||||
return $this; | |||||
} | |||||
public function getHeaderImageFile() { | |||||
return $this->assertAttached($this->headerImageFile); | |||||
} | |||||
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |