Данные из массива не загружаются в модель.
Модель:
private $socialType = [
'facebook' => 1,
'twitter' => 2,
'google+' => 3
];
public static function tableName()
{
return 'social_user';
}
public function rules()
{
return [
[['name', 'email', 'id'], 'required'],
[['name', 'email', 'id'], 'string', 'max' => 255],
//[['create_at', 'type', 'social_id'], 'safe']
];
}
public function attributeLabels()
{
return [
'social_user_id' => 'Social User ID',
'name' => 'Name',
'email' => 'Email',
'social_id' => 'Social ID',
'create_at' => 'Create At',
'type' => 'Type',
];
}
Контроллер:
public function authSuccess($client) {
$userAttributes = new SocialUser();
$u = $client->getUserAttributes();
if($userAttributes->load($client->getUserAttributes())) {
}
}
$u:
array (size=3)
'name' => string 'name' (length=16)
'email' => string 'email@email.ru' (length=17)
'id' => string '313312414' (length=16)