Php 有没有办法自动映射条令实体?

Php 有没有办法自动映射条令实体?,php,laravel,symfony,doctrine-orm,doctrine,Php,Laravel,Symfony,Doctrine Orm,Doctrine,因此,默认情况下,API平台在Doctrine.yaml中附带了这些Donctrine映射: mappings: App: is_bundle: false type: annotation dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App mappings: Product: is_bund

因此,默认情况下,API平台在
Doctrine.yaml
中附带了这些Donctrine映射:

mappings:
    App:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Entity'
        prefix: 'App\Entity'
        alias: App
mappings:
    Product:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Product/Entity'
        prefix: 'App\Product\Entity'
        alias: Product
    Order:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Order/Entity'
        prefix: 'App\Product\Entity'
        alias: Order
...
但是,我希望以这种方式构建我的实体:

src/Domain/
           Product/Entity/*.php
           Order/Entity/*.php
           Address/Entity/*.php
有没有一种方法可以在不向配置中添加新映射的情况下自动加载这些实体

我真的不想在
教义中这样做。yaml

mappings:
    App:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Entity'
        prefix: 'App\Entity'
        alias: App
mappings:
    Product:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Product/Entity'
        prefix: 'App\Product\Entity'
        alias: Product
    Order:
        is_bundle: false
        type: annotation
        dir: '%kernel.project_dir%/src/Order/Entity'
        prefix: 'App\Product\Entity'
        alias: Order
...

谢谢。

在走这条路之前,请确保您确实仔细考虑了您的设计,因为条令实体不是域实体,您可能会浪费大量精力试图将一个实体强制转换为另一个实体。这一映射难题对您来说应该有点危险。如果向Tristy.YAML添加部分是一个问题,那么考虑使用XML或甚至PHP映射。至少它将有助于将域层与持久层分开。