在Symfony2中,我试图实现FOS \ OAuthServerBundle,但是出现了一个奇怪的错误。在完成指南here以及official guide on GitHub之后,我遇到了错误消息:
Unrecognized field: randomId
500 Internal Server Error - ORMException
这是FOS \ OAuthServerBundle中客户端实体/模型中的受保护变量。我必须在这里遗漏一些简单的东西,但对于我的生活,我无法弄清楚是什么。
还有其他人遇到类似的错误吗?
尝试转到:
时会发生此错误http://symfony.local/app_dev.php/oauth/v2/token?grant_type=client_credentials&client_id=fd87dddb-6c29-11e4-90f3-b8ca3aa16897_fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk&client_secret=[secret redacted]
Doctrine\ORM\ORMException: Unrecognized field: randomId
at n/a
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php line 100
at Doctrine\ORM\ORMException::unrecognizedField('randomId')
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1681
at Doctrine\ORM\Persisters\BasicEntityPersister->getSelectConditionStatementColumnSQL('randomId', null)
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1610
at Doctrine\ORM\Persisters\BasicEntityPersister->getSelectConditionStatementSQL('randomId', 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk', null)
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1701
at Doctrine\ORM\Persisters\BasicEntityPersister->getSelectConditionSQL(array('id' => 'fd87dddb-6c29-11e4-90f3-b8ca3aa16897', 'randomId' => 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk'), null)
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1115
at Doctrine\ORM\Persisters\BasicEntityPersister->getSelectSQL(array('id' => 'fd87dddb-6c29-11e4-90f3-b8ca3aa16897', 'randomId' => 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk'), null, '0', '1', null, null)
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 746
at Doctrine\ORM\Persisters\BasicEntityPersister->load(array('id' => 'fd87dddb-6c29-11e4-90f3-b8ca3aa16897', 'randomId' => 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk'), null, null, array(), '0', '1', null)
in /home/johnny/Development/symfonyProject/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php line 196
at Doctrine\ORM\EntityRepository->findOneBy(array('id' => 'fd87dddb-6c29-11e4-90f3-b8ca3aa16897', 'randomId' => 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk'))
in /home/johnny/Development/symfonyProject/vendor/friendsofsymfony/oauth-server-bundle/FOS/OAuthServerBundle/Entity/ClientManager.php line 55
at FOS\OAuthServerBundle\Entity\ClientManager->findClientBy(array('id' => 'fd87dddb-6c29-11e4-90f3-b8ca3aa16897', 'randomId' => 'fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk'))
in /home/johnny/Development/symfonyProject/vendor/friendsofsymfony/oauth-server-bundle/FOS/OAuthServerBundle/Model/ClientManager.php line 41
at FOS\OAuthServerBundle\Model\ClientManager->findClientByPublicId('fd87dddb-6c29-11e4-90f3-b8ca3aa16897_fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk')
in /home/johnny/Development/symfonyProject/vendor/friendsofsymfony/oauth-server-bundle/FOS/OAuthServerBundle/Storage/OAuthStorage.php line 102
at FOS\OAuthServerBundle\Storage\OAuthStorage->getClient('fd87dddb-6c29-11e4-90f3-b8ca3aa16897_fzhfyllumw0kwwgkocg80wkg8sc4ko0soww0cks4gc0ogggk')
in /home/johnny/Development/symfonyProject/vendor/friendsofsymfony/oauth2-php/lib/OAuth2/OAuth2.php line 707
at OAuth2\OAuth2->grantAccessToken(object(Request))
in /home/johnny/Development/symfonyProject/vendor/friendsofsymfony/oauth-server-bundle/FOS/OAuthServerBundle/Controller/TokenController.php line 40
at FOS\OAuthServerBundle\Controller\TokenController->tokenAction(object(Request))
in line
at call_user_func_array(array(object(TokenController), 'tokenAction'), array(object(Request)))
in /home/johnny/Development/symfonyProject/app/bootstrap.php.cache line 2976
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /home/johnny/Development/symfonyProject/app/bootstrap.php.cache line 2938
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /home/johnny/Development/symfonyProject/app/bootstrap.php.cache line 3087
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /home/johnny/Development/symfonyProject/app/bootstrap.php.cache line 2337
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /home/johnny/Development/symfonyProject/web/app_dev.php line 18
答案 0 :(得分:2)
似乎某人有同样的问题并解决了它,只需阅读文章下面的评论:
“如果你的教条配置中没有激活auto_mapping,你需要在config.yml中为你的映射添加FOSOAuthServerBundle。”