Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 986 Bytes

annotation_facebook_id.md

File metadata and controls

50 lines (41 loc) · 986 Bytes

FacebookId

FacebookId is annotation to mark field in User class used to find User in database.

Example:

<?php
// src/AppBundle/Entity/User.php

namespace AppBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Lzakrzewski\FacebookAuthenticationBundle\Model\FacebookUser;
use Lzakrzewski\FacebookAuthenticationBundle\Annotation as Lzakrzewski;

/**
 * @ORM\Entity
 * @ORM\Table(name="users")
 */
class User extends BaseUser implements FacebookUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    
    /** 
     * @Lzakrzewski\FacebookId
     * @ORM\Column(type="bigint", nullable=true)
     */
    private $apiId;

    /** {@inheritdoc} */
    public function getFacebookId()
    {
        return $this->apiId;
    }

    /** {@inheritdoc} */
    public function setFacebookId($apiId)
    {
        $this->apiId = $apiId;
    }
}