【问题标题】:MappingException - The class 'generalBundle\Entity\xxx' was not found in the chain configured namespaces xxx - Upgrade to symfony flexMappingException - 在链配置的命名空间 xxx 中找不到类 'generalBundle\Entity\xxx' - 升级到 symfony flex
【发布时间】:2021-08-09 12:01:05
【问题描述】:

我在 Symfony 3.4 中有一个项目,我正在配置 flex,以便稍后转到 4.4 版本。 我已经设法修改了项目文件夹结构,并且正在尝试映射,但问题是旧配置无法正常工作。

这些是我的捆绑包(我在这里保持相同的结构):

> SRC
     > H360 (the place of my bundles)
           > comercialBundle
           > jasperBundle
           > generalBundle
           > ...

这是我的 orm 配置(我尝试设置“generalbundle”):

 orm:
    default_entity_manager: default
    auto_generate_proxy_classes: "%kernel.debug%"
    entity_managers:
      default:
        connection: default
        auto_mapping: true

        mappings:
          generalBundle:
            type: annotation
            prefix: 'H360\generalBundle'
            dir: '%kernel.project_dir%/src/H360/generalBundle/Entity'
            is_bundle: false
          translatable:
            type: annotation
            alias: Gedmo
            prefix: Gedmo\Translatable\Entity
            # make sure vendor library location is correct
            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
            is_bundle: false

错误是:“在链配置的命名空间 H360\generalBundle、Gedmo\Translatable\Entity 中找不到类 'generalBundle\Entity\GenParametros'”

有什么想法吗?

【问题讨论】:

  • 您的前缀是 H360\generalBundle 但您似乎使用 generalBundle\Entity\GenParametros 来导入实体。将其更改为 H360\generalBundle\Entity\GenParametros 或将前缀更改为 generalBundle。
  • 现在可以了!我几乎明白了,呵呵,谢谢@Vyctorya

标签: php symfony orm mapping symfony-flex


【解决方案1】:

您的前缀是 H360\generalBundle 但您似乎使用 generalBundle\Entity\GenParametros 来导入实体。将其更改为 H360\generalBundle\Entity\GenParametros 或将前缀更改为 generalBundle。

【讨论】:

    猜你喜欢
    • 2021-12-16
    • 1970-01-01
    • 2023-03-02
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 2019-08-17
    相关资源
    最近更新 更多