本文整理汇总了PHP中sfGuardUser::populateWithFacebook方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::populateWithFacebook方法的具体用法?PHP sfGuardUser::populateWithFacebook怎么用?PHP sfGuardUser::populateWithFacebook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::populateWithFacebook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populateFromFacebook
public function populateFromFacebook($doSave = true)
{
$fb = $this->getFacebook();
if (!($sfGuardUser = $this->getGuardUser())) {
if ($email = $fb->getEmail()) {
//-- Emails must be uniqe so start there
$sfGuardUser = Doctrine::getTable('sfGuardUser')->findOneByEmailAddress($email);
}
if (!$sfGuardUser && ($fb_uid = $fb->getId())) {
$sfGuardUser = Doctrine::getTable('sfGuardUser')->findOneByFacebookUid($fb_uid);
}
if (!$sfGuardUser) {
$sfGuardUser = new sfGuardUser();
}
}
//-- If it is in the session but not the guard User, add it to the guard user
if (!$sfGuardUser->getFacebookAuthCode() && $this->getAttribute('facebook_auth_code')) {
if (sfConfig::get('sf_logging_enabled')) {
sfContext::getInstance()->getLogger()->info('--- DEBUG --- FB AUTH CODE in session but not the guard User');
}
$sfGuardUser->setFacebookAuthCode($this->getAttribute('facebook_auth_code'));
}
$sfGuardUser->populateWithFacebook($fb);
if ($doSave) {
$sfGuardUser->save();
$this->signin($sfGuardUser);
}
//-- NOTE: The $sfGuardUser MAY NOT be saved yet!
$dispatcher = sfContext::getInstance()->getEventDispatcher();
$dispatcher->notify(new sfEvent($sfGuardUser, 'm14tFacebook.connect', array()));
return $sfGuardUser;
}