Changeset View
Changeset View
Standalone View
Standalone View
src/applications/draft/storage/PhabricatorVersionedDraft.php
Show All 29 Lines | public function setProperty($key, $value) { | ||||
$this->properties[$key] = $value; | $this->properties[$key] = $value; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getProperty($key, $default = null) { | public function getProperty($key, $default = null) { | ||||
return idx($this->properties, $key, $default); | return idx($this->properties, $key, $default); | ||||
} | } | ||||
public static function loadDrafts( | |||||
array $object_phids, | |||||
$viewer_phid) { | |||||
$rows = id(new self())->loadAllWhere( | |||||
'objectPHID IN (%Ls) AND authorPHID = %s ORDER BY version ASC', | |||||
$object_phids, | |||||
$viewer_phid); | |||||
$map = array(); | |||||
foreach ($rows as $row) { | |||||
$map[$row->getObjectPHID()] = $row; | |||||
} | |||||
return $map; | |||||
} | |||||
public static function loadDraft( | public static function loadDraft( | ||||
$object_phid, | $object_phid, | ||||
$viewer_phid) { | $viewer_phid) { | ||||
return id(new PhabricatorVersionedDraft())->loadOneWhere( | return id(new PhabricatorVersionedDraft())->loadOneWhere( | ||||
'objectPHID = %s AND authorPHID = %s ORDER BY version DESC LIMIT 1', | 'objectPHID = %s AND authorPHID = %s ORDER BY version DESC LIMIT 1', | ||||
$object_phid, | $object_phid, | ||||
$viewer_phid); | $viewer_phid); | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |