0
votes

Is it possible to generate entity files without Doctrine2 bundle in Symfony2 framework? I like the way how fast and easily entities can be generated in console, and FormType can be generated afterwards, based on entity

Now I am using 
1. generate:doctrine:entities
2. doctrine:generate:form
3. Remove all ORM annotations and primary key from entity.
- it is a bit lame so I hope there is a Symfony better way.

I do not need to persist entities, I use them for validation and collecting data from forms and then call web services.

1

1 Answers

1
votes

If you don't want to persist the entity then you can make the extra bundle and put some entity there. Then you can use different entity manager mapping for that.

In the config.yml file , by default all entities are managed by Entity manager in all bundles. But you can tell which bundles you want the doctrine to persist like this

orm:
    auto_generate_proxy_classes: %kernel.debug%

    default_entity_manager:   default
    entity_managers:
        default:
            connection:       default
            mappings:
                MyTestBundle1: ~
                MyMainBUndle2: ~
        logger_em:
            connection:       logger_connection
            mappings:
                MyExtraBundle: ~