diff --git a/Model/User.php b/Model/User.php index b066f2ee..fba8b41d 100644 --- a/Model/User.php +++ b/Model/User.php @@ -12,6 +12,7 @@ namespace Sylius\Component\Core\Model; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use FOS\UserBundle\Model\User as BaseUser; use Sylius\Component\Addressing\Model\AddressInterface; @@ -22,7 +23,6 @@ */ class User extends BaseUser implements UserInterface { - protected $firstName; protected $lastName; protected $createdAt; @@ -33,14 +33,15 @@ class User extends BaseUser implements UserInterface protected $billingAddress; protected $shippingAddress; protected $addresses; - protected $oauths; + protected $oauthAccounts; public function __construct() { - $this->createdAt = new \DateTime(); - $this->orders = new ArrayCollection(); - $this->addresses = new ArrayCollection(); - $this->oauths = new ArrayCollection(); + $this->createdAt = new \DateTime(); + $this->orders = new ArrayCollection(); + $this->addresses = new ArrayCollection(); + $this->oauthAccounts = new ArrayCollection(); + parent::__construct(); } @@ -62,7 +63,6 @@ public function setCurrency($currency) return $this; } - /** * {@inheritdoc} */ @@ -279,12 +279,12 @@ public function setEmailCanonical($emailCanonical) } /** - * Get oauth ids + * Get connect OAuth accounts. * - * @return \Doctrine\Common\Collections\Collection + * @return Collection|UserOAuth[] */ - public function getOauths() + public function getOAuthAccounts() { - return $this->oauths; + return $this->oauthAccounts; } } diff --git a/Model/UserOauth.php b/Model/UserOauth.php index 2cfe8bc4..26160627 100644 --- a/Model/UserOauth.php +++ b/Model/UserOauth.php @@ -11,23 +11,22 @@ namespace Sylius\Component\Core\Model; - - /** - * User model. + * User OAuth model. * - * @author Paweł Jędrzejewski + * @author Sergio Marchesini */ -class UserOauth +class UserOAuth { - protected $id; protected $provider; - protected $canonicalId; - protected $user; - - + protected $identifier; + protected $accessToken; + /** + * @var UserInterface + */ + protected $user; /** * Get id @@ -40,11 +39,21 @@ public function getId() } /** - * Set provider + * Get OAuth provider name. + * + * @return string + */ + public function getProvider() + { + return $this->provider; + } + + /** + * Set OAuth provider name. * * @param string $provider * - * @return UserOauth + * @return self */ public function setProvider($provider) { @@ -54,52 +63,49 @@ public function setProvider($provider) } /** - * Get provider + * Get OAuth identifier. * * @return string */ - public function getProvider() + public function getIdentifier() { - return $this->provider; + return $this->identifier; } /** - * Set canonicalId + * Set OAuth identifier. * - * @param string $canonicalId + * @param string $identifier * - * @return UserOauth + * @return self */ - public function setCanonicalId($canonicalId) + public function setIdentifier($identifier) { - $this->canonicalId = $canonicalId; + $this->identifier = $identifier; return $this; } /** - * Get canonicalId + * Get OAuth access token. * * @return string */ - public function getCanonicalId() + public function getAccessToken() { - return $this->canonicalId; + return $this->accessToken; } - - - /** - * Set user + * Set OAuth access token. * - * @param UserInterface $user + * @param string $accessToken * - * @return UserOauth + * @return self */ - public function setUser(UserInterface $user = null) + public function setAccessToken($accessToken) { - $this->user = $user; + $this->accessToken = $accessToken; return $this; } @@ -113,4 +119,18 @@ public function getUser() { return $this->user; } + + /** + * Set user. + * + * @param UserInterface $user + * + * @return self + */ + public function setUser(UserInterface $user) + { + $this->user = $user; + + return $this; + } }