kopia lustrzana https://github.com/nextcloud/social
Add method to get actor by id
Signed-off-by: Julius Härtl <jus@bitgrid.net>pull/21/head
rodzic
8d66e5dc04
commit
9187acfc47
|
@ -109,6 +109,26 @@ class ActorsRequest extends ActorsRequestBuilder {
|
|||
return $this->parseActorsSelectSql($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @return Person
|
||||
* @throws ActorDoesNotExistException
|
||||
*/
|
||||
public function getFromId(string $id): Person {
|
||||
$qb = $this->getActorsSelectSql();
|
||||
$this->limitToIdString($qb, $id);
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
if ($data === false) {
|
||||
throw new ActorDoesNotExistException('Actor not found');
|
||||
}
|
||||
|
||||
return $this->parseActorsSelectSql($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return Actor from database, based on the userId of the owner.
|
||||
|
|
|
@ -90,6 +90,12 @@ class ActorService {
|
|||
return $actor;
|
||||
}
|
||||
|
||||
public function getActorById(string $id): Person {
|
||||
$actor = $this->actorsRequest->getFromId($id);
|
||||
|
||||
return $actor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $userId
|
||||
|
|
Ładowanie…
Reference in New Issue