Skip to content

Instantly share code, notes, and snippets.

@caefer
Created March 22, 2011 19:42
Show Gist options
  • Select an option

  • Save caefer/881892 to your computer and use it in GitHub Desktop.

Select an option

Save caefer/881892 to your computer and use it in GitHub Desktop.
<?php
namespace MyProject\MyBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
/**
* @orm:Entity
*/
class User extends BaseUser
{
/**
* @orm:Id
* @orm:Column(type="integer")
* @orm:generatedValue(strategy="AUTO")
*/
protected $id;
/**
* @orm:Column(type="string")
*/
protected $facebookID;
/**
* @orm:Column(type="array")
*/
protected $FBData;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
/**
* Set facebookID
*
* @param string $facebookID
*/
public function setFacebookID($facebookID)
{
$this->facebookID = $facebookID;
}
/**
* Get facebookID
*
* @return string $facebookID
*/
public function getFacebookID()
{
return $this->facebookID;
}
/**
* Set FBData
*
* @param array $fBData
*/
public function setFBData($fBData)
{
$this->salt = $fBData['id'];
$this->setFacebookID($fBData['id']);
$this->setLocked(false);
$this->setExpired(false);
$this->setCredentialsExpired(false);
$this->setUsername($fBData['id']);
$this->setEmail($fBData['id'].'@facebook.com');
// add facebook specific role to use with access control
$this->addRole('ROLE_FACEBOOK');
$this->FBData = $fBData;
}
/**
* Get FBData
*
* @return array $fBData
*/
public function getFBData()
{
return $this->FBData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment