My vote goes to solution 3.

Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

On 1/25/11 2:55 PM, Bernhard Schussek wrote:
Hi everyone,

I would like to pull the classes responsible for tieing Doctrine 2 and
the Form/Validator component together out of DoctrineBundle. The
reason for this is that currently people who work with for example
Forms+Doctrine 2, but not Symfony2, can't use these supporting classes
(except if they include DoctrineBundle in their project, which is
silly).

I see different solutions two this problems for which I'd like to hear
your opinions.

1. Include support classes in Symfony2 components
----------------------------------------------------------------------------
We include the support classes alongside the normal classes in the
same components and namespaces.

Symfony\
   Component\
     Form\
       ...
       DoctrineChoiceField
       FieldFactory\
         ...
         DoctrineFieldFactoryGuesser
         ValidatorFieldFactoryGuesser
       ValueTransformer\
         ...
         DoctrineCollectionToChoiceTransformer

+ simple, no organization overhead
- independent classes and classes for extensions are mixed. This
shouldn't be a problem if we document properly that these few classes
can only be used if the appropriate extension is installed

2. Include classes in separate namespaces
---------------------------------------------------------------
We include support in the components, but in a separate namespace.

Symfony\
   Component\
     Form\
       ...
       FieldFactory\
         ...
       ValueTransformer\
         ...
       Extension\
         Doctrine\
           DoctrineChoiceField
           FieldFactory\
             DoctrineFieldFactoryGuesser
           ValueTransformer\
             DoctrineCollectionToChoiceTransformer
         Validator\
           FieldFactory\
             ValidatorFieldFactoryGuesser

+ logical separation of the classes
- lots of namespace overhead, duplicate namespaces and namespaces that
contain only one class
- long absolute namespace names (e.g.
"Symfony\Component\Form\Extension\Doctrine\ValueTransformer\DoctrineToChoiceTransformer")

3. Include classes in separate tiein packages
---------------------------------------------------------------
We include support in separate components, so-called "Tie-ins", that
can be installed when needed.

Symfony\
   Tiein\
     FormDoctrine\
       DoctrineChoiceField
       FieldFactory\
         DoctrineFieldFactoryGuesser
       ValueTransformer\
         DoctrineCollectionToChoiceTransformer
     FormValidator\
       FieldFactory\
         ValidatorFieldFactoryGuesser

+ logical separation of the classes
- namespace overhead, but slightly less than in solution 2
- complicated installation procedure


My personal favourite is solution 1, because it is the simplest one
and the only counter argument (the logical separation) is mainly a
philosophical one.

What do you think?


Bernhard
--
Software Architect&  Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart


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