Hi all!

Usually when you want to write some class of the model (entities or
documents) or forms you do it in bundles. But what if you want do you do if
you to use some tool like Doctrator?

If you want for instance customize some entity class in your project, you
cannot do it if you don't modify the bundle.
The symfony1 way to solve this issue is to generate the final classes of the
model and forms in the project, then you can customize them.

What do you think about to do something like that in Symfony2? For instance:

src/Gen/DoctratorUserBundle/Entity/User.php > User bundle
src/Gen/DoctratorUserBundle/Entity/UserRepository.php > UserRepository
bundle
src/Gen/DoctratorUserBundle/Entity/Base/User.php
src/Gen/DoctratorUserBundle/Entity/Base/UserRepository.php

In the bundle:

src/Bundle/DoctratorUserBundle/Entity/User.php > User base
src/Bundle/DoctratorUserBundle/Entity/UserRepository.php > UserRepository
base

If we do this we will be able to have a standard way to call model classes
and to customize them.

The standard:
Gen/DoctratorUserBundle/Entity/User
$em->getRepository('Gen/DoctratorUserBundle/Entity/User');

And we will be able to use another great Doctrator feature: to extend the
entity mapping in another bundles. For instance:

# DoctratorUserBundle
Bundle\DoctratorUserBundle\Entity\User:
    columns:
        id: { id: auto, type: integer }
        username: { type: string, length: 100 }

# DoctratorForumBundle
Bundle\DoctratorUserBundle\Entity\User:
    columns:
        signature: text

This example extends the mapping of the DoctratorUserBundle in the
DoctratorForumBundle, but if you generate the base class in the bundles it
would change if you change the class definition.

Well, what do you think about do it? Do you have more ideas to call the dir
(instead of Gen)?

For people than don't know Doctrator:
http://mondongo.es/blog/9/doctrator-real-and-flexible-behaviors-for-doctrine2

And if you want to try this way to use model classes, you can do it in the
DoctratorBundle:
https://github.com/pablodip/DoctratorBundle/commit/befddd5a62d799ce497d2761824ec38c432a0129

Thanks,
Pablo

-- 
*Pablo Díez | @pablodip*
MondonGO Lead Developer
http://mondongo.es

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to