Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/storage/PhamePost.php
Show All 28 Lines | final class PhamePost extends PhameDAO | ||||
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()) | ||||
->setBlog($blog) | ->setBlog($blog) | ||||
->setDatePublished(0) | ->setDatePublished(PhabricatorTime::getNow()) | ||||
epriestley: For consistency, prefer `PhabricatorTime::getNow()` (which allows unit tests to force the… | |||||
->setVisibility(PhameConstants::VISIBILITY_PUBLISHED); | ->setVisibility(PhameConstants::VISIBILITY_PUBLISHED); | ||||
return $post; | return $post; | ||||
} | } | ||||
public function setBlog(PhameBlog $blog) { | public function setBlog(PhameBlog $blog) { | ||||
$this->blog = $blog; | $this->blog = $blog; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 249 Lines • Show Last 20 Lines |
For consistency, prefer PhabricatorTime::getNow() (which allows unit tests to force the "current time" to some specific known time).