编程语言
首页 > 编程语言> > PHP-Symfony2-如何删除/移动实体?

PHP-Symfony2-如何删除/移动实体?

作者:互联网

我正在学习symfony2,并尝试捆绑创建一些教义实体,所以我想移动它们.

但是,在移动并更改了引用的所有实例之后,尝试运行我的应用程序时出现错误.

我把它们移回去,一切都很好.

现在,我只是想完全删除它们,但是再次,这样做时出现错误.

完全删除实体有什么帮助吗?

解决方法:

我做的事情和Pablo先生完全一样,只是做了一个捆绑包:我移动了一个捆绑包(重命名)并修改了对其的所有调用.

我有同样的错误:

ErrorException: Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php line 65
at ErrorHandler->handle() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
at AbstractToken->getUsername() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php line 56
at SecurityDataCollector->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php line 174
at Profiler->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php line 90
at ProfilerListener->onKernelResponse()
at call_user_func() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php line 82
at TraceableEventDispatcher->doDispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3678
at EventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4754
at ContainerAwareEventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3904
at HttpKernel->filterResponse() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3896
at HttpKernel->handleRaw() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3846
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4791
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/bootstrap.php.cache line 547
at Kernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/web/app_dev.php line 20

一些帮助将非常受欢迎:)

编辑:

好吧,我解决了这个问题,亚当·斯泰西(Adam Stacey)听得很好:

在进行任何更改之前,我使用FOSUserBundle防火墙登录了网站.
通过更改包的名称,它欺骗了防火墙,并被卡在./vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php的第70行
这是函数:

public function getUsername()
{
    if ($this->user instanceof UserInterface) {
        return $this->user->getUsername();
    }

    return (string) $this->user;
}

因此,我注释掉了行return(string)$this-> user ;,重新加载了网页,然后注销,而不是恢复了注释.和瞧!

标签:symfony,php
来源: https://codeday.me/bug/20191208/2088525.html