protected function loadPage() { $table = new DoorkeeperExternalObject(); $conn_r = $table->establishConnection('r'); $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r)); return $table->loadAllFromArray($data); }
public function fillObjectFromData(DoorkeeperExternalObject $obj, $result) { // Convert the "self" URI, which points at the REST endpoint, into a // browse URI. $self = idx($result, 'self'); $object_id = $obj->getObjectID(); $uri = self::getJIRAIssueBrowseURIFromJIRARestURI($self, $object_id); if ($uri !== null) { $obj->setObjectURI($uri); } }
protected final function saveExternalObject(DoorkeeperObjectRef $ref, DoorkeeperExternalObject $obj) { $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); try { $obj->save(); } catch (AphrontDuplicateKeyQueryException $ex) { // In various cases, we may race another process importing the same // data. If we do, we'll collide on the object key. Load the object // the other process created and use that. $obj = id(new DoorkeeperExternalObjectQuery())->setViewer($this->getViewer())->withObjectKeys(array($ref->getObjectKey()))->executeOne(); if (!$obj) { throw new PhutilProxyException(pht('Failed to load external object after collision.'), $ex); } $ref->attachExternalObject($obj); } unset($unguarded); }
public function fillObjectFromData(DoorkeeperExternalObject $obj, $result) { $body = $result->getBody(); $uri = $body['html_url']; $obj->setObjectURI($uri); $title = idx($body, 'title'); $description = idx($body, 'body'); $created = idx($body, 'created_at'); $created = strtotime($created); $state = idx($body, 'state'); $obj->setProperty('task.title', $title); $obj->setProperty('task.description', $description); $obj->setProperty('task.created', $created); $obj->setProperty('task.state', $state); }
public function fillObjectFromData(DoorkeeperExternalObject $obj, $result) { $id = $result['id']; $uri = "https://app.asana.com/0/{$id}/{$id}"; $obj->setObjectURI($uri); }
public function fillObjectFromData(DoorkeeperExternalObject $obj, $spec) { $uri = $spec['html_url']; $obj->setObjectURI($uri); $login = $spec['login']; $obj->setDisplayName(pht('%s <%s>', $login, pht('GitHub'))); }