我正在尝试使用 FOSOAuthServerBundle 但遇到崩溃问题,崩溃消息是:
PHP Fatal error: Declaration of MP\OAuthBundle\Entity\AccessToken::setUser() must be compatible with that of FOS\OAuthServerBundle\Model\TokenInterface::setUser() in /home/bitnami..../OAuthBundle/Entity/AccessToken.php on line 13
AccessToken.class:
<?php
namespace MP\OAuthBundle\Entity;
use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="oauth_access_tokens")
*/
class AccessToken extends BaseAccessToken
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Client")
* @ORM\JoinColumn(nullable=false)
*/
protected $client;
/**
* @ORM\ManyToOne(targetEntity="\MP\UserBundle\Entity\User")
*/
protected $user;
}
令牌接口::setUser:
/**
* @param UserInterface $user
*/
function setUser(UserInterface $user);
用户类
namespace MP\UserBundle\Entity;
use Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
/**
* User
*/
class User extends BaseUser
{
const ROLE_ADMIN = 'ROLE_ADMIN';
/**
* @var integer
...
我仍然看不出问题出在哪里!我的用户最后实现了 UserInterface!
任何想法?