Symfony2 FOSUserBundle和组错误 [英] Symfony2 FOSUserBundle and groups error
问题描述
应用
php应用程序/控制台原则时出现错误:schema:update --force
我得到一堆错误,从
<$ p开始$ p>
PHP致命错误:Tracker\MembersBundle\Entity\User :: addGroup()的声明必须与FOS\UserBundle\兼容
C:\程序文件(x86)中的Model\GroupableInterface :: addGroup()\Zend\Apache2\htdocs\mysite\src\Tracker\MembersBundle\Entity\User.php 14
PHP堆栈跟踪:
PHP 1. {main}()C:\Program Files(x86)\Zend\Apache2\htdocs\mysite\app\console:0
PHP 2. Symfony\组件\控制台\Application-> run()C:\Program Files(x86)\Zend\Apache2\htdocs\mysite\app\console :22
PHP 3. Symfony\捆绑\FrameworkBundle\控制台\Application-> doRun()C:\Program Files(x86)\Zend\Apache2\htdocs\mysite\ \供应商\symfony\src\Symfony\组件\Console\Application.php:118
PHP 4. Symfony\Comp onent\控制台\Application-> doRun()C:\Program Files(x86)\Zend\Apache2\htdocs\mysite\vendor\symfony\src\Symfony\Bundle\ \FrameworkBundle\控制台\Application.php:75
我想出了 User :: addGroup()
和 FOSUserBundle
的 groups
实现...但是我不知道如何最终解决它……这是我的两个实体
更新:
如果我只是从用户实体中删除addGroup()并转到路径
http://mysite.com/app_dev.php/group/new
i出现致命错误
致命错误:FOS\UserBundle\Form\Type\GroupFormType :: getDefaultOptions()的声明必须与Symfony\Component\Form\FormTypeInterface :: getDef的声明兼容C:\Program文件(x86)\Zend\Apache2\htdocs\mysite\vendor\bundles\FOS\UserBundle\Form\Type\GroupFormType.php中的aultOptions() 18
您必须添加<$ c $的FQCN您的 User
类中的c> GroupableInterface 例如
使用FOS\UserBundle\Model\GroupableInterface;
编辑:
您必须更新symfony。由于它们已更改 getDefaultOptions
的功能签名。在此处。
i am getting an error, when applying
php app/console doctrine:schema:update --force
i get a stack of errors, starting with
PHP Fatal error: Declaration of Tracker\MembersBundle\Entity\User::addGroup() must be
compatible with that of FOS\UserBundle\Model\GroupableInterface::addGroup() in C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\src\Tracker\MembersBundle\Entity\User.php on line 14
PHP Stack trace:
PHP 1. {main}() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\app\console:22
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\symfony\src\Symfony\Component\Console\Application.php:118
PHP 4. Symfony\Component\Console\Application->doRun() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:75
i figured out User::addGroup()
and the groups
implementation of FOSUserBundle
...but i do not know how to ultimately solve it...here are my two entities
Update: if i simply remove addGroup() from the User Entity, and go to the path http://mysite.com/app_dev.php/group/new i get a fatal error
Fatal error: Declaration of FOS\UserBundle\Form\Type\GroupFormType::getDefaultOptions() must be compatible with that of Symfony\Component\Form\FormTypeInterface::getDefaultOptions() in C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\bundles\FOS\UserBundle\Form\Type\GroupFormType.php on line 18
You have to add FQCN of GroupableInterface
in your User
class e.g
use FOS\UserBundle\Model\GroupableInterface;
Edit:
You have to update symfony. As they have changed function signature of getDefaultOptions
. Check here.
这篇关于Symfony2 FOSUserBundle和组错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!