4

求助谁知道,fosElasticaBundle没有上传嵌套实体,为什么?我有疑问,当我在弹性中创建人才时,不要上传嵌套实体,而是在编辑此人才时 - 在弹性中上传嵌套字段。为什么只有在编辑时才能嵌套创建人才不上传?创建时:

    $user->setDeveloper($developer);
    $this->getDoctrine()->getManager()->persist($user);
    $this->getDoctrine()->getManager()->persist($developer);
    $manager->flush();

更新时:

    $manager->flush();

配置:

    fos_elastica:
clients:
    default:
      host: %elastica_host%
      port: %elastica_port%
      headers: { Authorization: Basic %elastica_auth_header% }

indexes:
    profile:
        finder: ~
        types:
             talent:
                mappings:
                    id:
                       type: integer
                    slug:
                       type: string
                    description:
                       type: string
                    user:
                        type: "nested"
                        properties:
                             id: ~
                             username:
                                type: string

当我更改嵌套实体时-首先用户和开发人员一切正常,现在

            talent:
                mappings:
                      id: ~
                      username:
                          type: string
                      firstName:
                          type: string
                      developer:
                          type: "nested"
                          properties:
                              id:
                                 type: integer
                              slug:
                                 type: string

但是我的团队中有实体团队有嵌套的实体开发人员,他们在开发人员嵌套用户中查找开发人员。当我在弹性团队中为团队创建开发人员而不更新时,只有当我编辑团队时,如何解决这个问题可能会覆盖一些我不知道的监听器。当我创建开发人员时,我为这个开发人员刷新了团队,但仍然没有更新弹性

    indexes:
    profile:
        finder: ~
        types:
            team:
                 mappings:
                     id:
                       type: integer
                     slug:
                       type: string

                     developers:
                        type: "nested"
                        properties:
                            id:
                               type: integer
                            slug:
                               type: string
                            user:
                               type: "nested"
                               properties:
                                   id: ~
                                   username:
                                      type: string
                                   firstName:
                                      type: string

这是我的听众,也许需要像这样的自定义插入?

                    listener:
                        insert: true
                        update: true
                        delete: true

但我认为如果听众:〜这一切变种与否?

                persistence:
                      driver: orm
                      model: Artel\ProfileBundle\Entity\Developer
                      provider: ~
                      listener: ~
                      finder: ~

我尝试这样,但仍然嵌套实体未在弹性中上传

                          listener:
                        immediate: true

我尝试了这个,但仍然没有上传嵌套(并且〜这是默认的插入,更新,删除)

                          listener:
                        insert: true
                        update: false
                        delete: true

请帮忙

4

0 回答 0