How to use Symfony2 entities from a bundle in vendor/bundles

Today I was working on a bundle for generating invoices. Since we have some kind of invoice functionality in many projects in the past, my goal was to create a nice reusable bundle.
So I started with creating an empty bundle and moved it to /vendor/bundles/Netvlies/Bundle/InvoiceBundle.

With the app/console I started generating a entity for persisting particular data for an invoice:

This is still all pretty straight forward… so to complete this difficult task I tried to create to update the schema:

Hmmz, wtf? 🙁 For some obvious reason it was ignoring my new bundle outside the src structure? After some little investigation I discovered you have to add it to your ORM mapping like this:

3 thoughts on “How to use Symfony2 entities from a bundle in vendor/bundles

    1. Hi mile,

      Can you provide your config.yml? What method do you use to map your entities, annotations or something else?

  1. Thanks. I was just thinking about “outsourcing” my FOSUserBundle “ChildBundle” for our cms projects and wasn’t sure if I could load orm entities from vendor folders.

Leave a Reply

Your email address will not be published. Required fields are marked *