Add method to get actor by id

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/21/head
Julius Härtl 2018-11-13 15:30:48 +01:00
rodzic 8d66e5dc04
commit 9187acfc47
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
2 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -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.

Wyświetl plik

@ -90,6 +90,12 @@ class ActorService {
return $actor;
}
public function getActorById(string $id): Person {
$actor = $this->actorsRequest->getFromId($id);
return $actor;
}
/**
* @param string $userId