简体   繁体   中英

Symfony3 / Doctrine MongoDB ODM: other folder than Bundle/Documents?

Is it possible to place your Entity models in a different place than Bundle/Documents in Symfony3?

I had an entity model in Bundle/Documents/Product.php and it was working fine. Then I changed the location to Bundle/Entity/Product and updated the FQCN to reflect that everywhere.

However, I'm now getting the error:

[Doctrine\Common\Persistence\Mapping\MappingException]
Class 'Acme\StoreBundle\Document\Product' does not exist

Even though there are no references to that FQCN anywhere in the project. Does this mean it is not possible to use another folder or am I missing some configuration?

If you are moving your Documents to a non-standard folder you need to let Doctrine know about this in bundle's configuration, you can refer to the docs for more informations.

Also here's part of my configuration for reference:

document_managers:
    default:
        mappings:
            Core:
                type: annotation
                dir: "%kernel.root_dir%/../lib/Application/Core/Model"
                prefix: CompanyManager\Application\Core\Model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM