select(['oauth_clients.id', 'oauth_clients.name']) ->join('oauth_sessions', 'oauth_clients.id', '=', 'oauth_sessions.client_id') ->where('oauth_sessions.id', $session->getId()) ->get(); if (count($result) === 1) { $client = new ClientEntity($this->server); $client->setId($result[0]['id']); $client->setName($result[0]['name']); return $client; } } }