Symfony FOSElasticaBundle干扰生命周期事件
我已安装FOSElasticaBundle来处理搜索,并使用了以下配置:Symfony FOSElasticaBundle干扰生命周期事件,symfony,doctrine-orm,doctrine,fosuserbundle,foselasticabundle,Symfony,Doctrine Orm,Doctrine,Fosuserbundle,Foselasticabundle,我已安装FOSElasticaBundle来处理搜索,并使用了以下配置: fos_elastica: clients: default: { host: localhost, port: 9200 } indexes: search: client: default types: post: mappings:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
search:
client: default
types:
post:
mappings:
postTitle: ~
postContent: ~
persistence:
driver: orm
model: Shop\Bundle\ManagementBundle\Entity\Post
provider: ~
listener: ~
finder: ~
搜索工作正常,但当我尝试登录用户时,他已成功登录,但我重定向到login\u check
route,出现以下错误:
ContextErrorException:可捕获致命错误:参数1传递给
FOS\ElasticaBundle\Doctrine\Listener::postUpdate()必须是实例
条令\Common\Persistence\Event\LifecycleEventArgs的实例
条令\ORM\Event\LifecycleEventArgs已给定,已调用
C:\xampp\htdocs\community\vendor\symfony\symfony\src\symfony\Bridge\doctor\ContainerAwareEventManager.php
在第63行,并在中定义
C:\xampp\htdocs\community\vendor\friendsofsymfony\elastica bundle\doctor\Listener.php
第111行
如果我没有错的话,login\u check
路径正在更新用户的记录(正好是user
表中的最后一个登录日期字段),这将触发postUpdate()
生命周期事件。但我无法解决这个问题。谢谢你的帮助
PS:我正在使用FOSUserBundle来存储数据库中的用户
编辑:上述问题也适用于其他实体的持久性生命周期事件(preRemove()…)