Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony DoctrineExtensions softdeletable返回已删除的实体_Symfony_Doctrine Orm_Soft Delete - Fatal编程技术网

Symfony DoctrineExtensions softdeletable返回已删除的实体

Symfony DoctrineExtensions softdeletable返回已删除的实体,symfony,doctrine-orm,soft-delete,Symfony,Doctrine Orm,Soft Delete,我在我的symfony应用程序中安装了stof/DoctrineExtensions,并对所有内容进行了必要的配置 当我删除一个实体时,deletedAt被设置并且一切都正常,但是当我查找时,删除的实体仍然返回 $zorgboer = $em->getRepository('stroPublicBundle:Zorgboerderij')->find(3); $em->remove($zorgboer); $em->flush(); $zorgboer

我在我的symfony应用程序中安装了stof/DoctrineExtensions,并对所有内容进行了必要的配置

当我删除一个实体时,deletedAt被设置并且一切都正常,但是当我查找时,删除的实体仍然返回

  $zorgboer = $em->getRepository('stroPublicBundle:Zorgboerderij')->find(3);

  $em->remove($zorgboer);
  $em->flush();

  $zorgboeren = $em->getRepository('stroPublicBundle:Zorgboerderij')->findAll();

@编辑:好的,我找到了解决方案。问题是实体Zorgboerdererij扩展了另一个实体。软数据表必须在父级上。现在它工作了

也许你忘了在app/config.yml中设置
SoftDeleteableFilter

doctrine:
    ...
    orm:
        filters:
            softdeleteable:
                class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
                enabled: true

这将启用SoftDeleteable筛选器,因此“软删除”的实体将不会出现在结果中。

是否将筛选器添加到您的条令配置中?