Remove some circular references

This commit is contained in:
Romain Neutron
2014-02-20 19:14:35 +01:00
parent 9e650a7954
commit 862fe696cb
18 changed files with 52 additions and 47 deletions

View File

@@ -497,19 +497,18 @@ class API_OAuth2_Adapter extends OAuth2
/**
*
* @param usr_id $usr_id
* @param User $user
* @return API_OAuth2_Account
*/
public function updateAccount($usr_id)
public function updateAccount(User $user)
{
if ($this->client === null)
throw new logicalException("Client property must be set before update an account");
try {
$user = $this->app['manipulator.user']->getRepository()->find($usr_id);
$account = API_OAuth2_Account::load_with_user($this->app, $this->client, $user);
} catch (\Exception $e) {
$account = $this->createAccount($usr_id);
$account = $this->createAccount($user->getId());
}
return $account;
@@ -795,7 +794,11 @@ class API_OAuth2_Adapter extends OAuth2
return false;
}
$account = $this->updateAccount($usr_id);
if (null === $user = $this->app['manipulator.user']->getRepository()->find($usr_id)) {
return false;
}
$account = $this->updateAccount($user);
return [
'redirect_uri' => $this->client->get_redirect_uri()