protected function _patchProfile(
        $providerName,
        SocialConnectUser $identity,
        AccessTokenInterface $accessToken,
        EntityInterface $profile = null
    ) {
        if ($profile === null) {
            $profile = $this->_profileModel->newEntity([
                'provider' => $providerName,
            ]);
        }

        $data = [
            'access_token' => $accessToken,
        ];

        foreach (get_object_vars($identity) as $key => $value) {
            switch ($key) {
                case 'id':
                    $data['identifier'] = $value;
                    break;
                case 'lastname':
                    $data['last_name'] = $value;
                    break;
                case 'firstname':
                    $data['first_name'] = $value;
                    break;
                case 'birthday':
                    $data['birth_date'] = $value;
                    break;
                case 'emailVerified':
                    $data['email_verified'] = $value;
                    break;
                case 'fullname':
                    $data['full_name'] = $value;
                    break;
                case 'sex':
                    $data['gender'] = $value;
                    break;
                case 'pictureURL':
                    $data['picture_url'] = $value;
                    break;
                default:
                    $data[$key] = $value;
                    break;
            }
        }

        return $this->_profileModel->patchEntity($profile, $data);
    }
protected function _patchProfile(
        $providerName,
        SocialConnectUser $identity,
        AccessTokenInterface $accessToken,
        EntityInterface $profile = null
    ) {
        if ($profile === null) {
            $profile = $this->_profileModel->newEntity([
                'provider' => $providerName,
            ]);
        }

        $data = [
            'access_token' => $accessToken,
        ];

        foreach (get_object_vars($identity) as $key => $value) {
            switch ($key) {
                case 'id':
                    $data['identifier'] = $value;
                    break;
                case 'lastname':
                    $data['last_name'] = $value;
                    break;
                case 'firstname':
                    $data['first_name'] = $value;
                    break;
                case 'birthday':
                    $data['birth_date'] = $value;
                    break;
                case 'emailVerified':
                    $data['email_verified'] = $value;
                    break;
                case 'fullname':
                    $data['full_name'] = $value;
                    break;
                case 'sex':
                    $data['gender'] = $value;
                    break;
                case 'pictureURL':
                    $data['picture_url'] = $value;
                    break;
                default:
                    $data[$key] = $value;
                    break;
            }
        }

        return $this->_profileModel->patchEntity($profile, $data);
    }
protected function _patchProfile ( $ providerName , SocialConnectUser $ identity , AccessTokenInterface $ accessToken , EntityInterface $ profile = null ) { if ( $ profile === null ) { $ profile = $ this -> _profileModel -> newEntity ( [ 'provider' => $ providerName , ] ) ; } $ data = [ 'access_token' => $ accessToken , ] ; foreach ( get_object_vars ( $ identity ) as $ key => $ value ) { switch ( $ key ) { case 'id' : $ data [ 'identifier' ] = $ value ; break ; case 'lastname' : $ data [ 'last_name' ] = $ value ; break ; case 'firstname' : $ data [ 'first_name' ] = $ value ; break ; case 'birthday' : $ data [ 'birth_date' ] = $ value ; break ; case 'emailVerified' : $ data [ 'email_verified' ] = $ value ; break ; case 'fullname' : $ data [ 'full_name' ] = $ value ; break ; case 'sex' : $ data [ 'gender' ] = $ value ; break ; case 'pictureURL' : $ data [ 'picture_url' ] = $ value ; break ; default : $ data [ $ key ] = $ value ; break ; } } return $ this -> _profileModel -> patchEntity ( $ profile , $ data ) ; }
Get social profile entity.

@param string $providerName Provider name.
@param \SocialConnect\Common\Entity\User $identity Social connect entity.
@param \SocialConnect\Provider\AccessTokenInterface $accessToken Access token
@param \Cake\Datasource\EntityInterface $profile Social profile entity

@return \Cake\Datasource\EntityInterface
Get social profile entity .