私はApigilityとoAuth2を使い始めました。データベースから情報を取得する際に、現在認証されている "loggedin"ユーザーを取得できるかどうか疑問に思っていました。現在のユーザー情報を入手する
は、私は現在、次のコードを持っている:
/**
* Fetch all or a subset of resources
*
* @param array $params
* @return mixed
*/
public function fetchAll($params = array())
{
var_dump($params);
// Using Zend\Db's SQL abstraction
$sql = new \Zend\Db\Sql\Sql($this->db);
//I would like to get the currently logged in user here... but how?
$select = $sql->select('projects')->where(array('userid' => 1));;
// This provides paginated results for the given Select instance
$paged = new \Zend\Paginator\Adapter\DbSelect($select, $this->db);
// which we then pass to our collection
return new ProjectsCollection($paged);
}
を私はすでに検索の多くをやったが、私は、ユーザー情報やアクセストークンにアクセスする方法を見当もつかない、私はのためのリクエストヘッダを解析する必要がありますこの?
ありがとうございました!私はそれを仕事にしました。私は最後に '$ this-> getIdentity() - > getRoleId()'でユーザIDを取得することもできました。 –
ニース。私はそれに気付かなかった! –