0

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 Answer 1

1

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: ~
2
  • Hi, probably I did not wrote it clearly. I would like to generate entity, without ORM annotations, from console, and then generate FormType for that entity. Is that possible without Doctrine?
    – mrok
    Jan 19, 2013 at 19:59
  • When you generate entity then dont use with--annotation or use yml file and then delete it
    – Mirage
    Jan 20, 2013 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.