Thanks for the info Richard.

I am very familiar with MVC. My question was more specifically on how
Symfony 2 is structured to support MVC. I could easily start right now and
build a site using my own assumptions, but some best practice advice is what
I'm after.

For example, if I were to build a project using what I know, I'd likely do
the following:

   - Build a bundle for each piece of my project. Similarly to as you
   described.
   - Build forms on-the-fly in the controller as needed. Refactoring shared
   forms to some other class, that if I was using Symfony 1, would be stored in
   the lib directory. I'm not yet sure where to store this in a Symfony 2
   project.
   - Use annotations on the Entity classes for both Validation and ORM.
   - Use the Doctrine event system for creating user level logs.

There few couple of things I am unsure of how to do at the moment (I'm still
reading all the docs though):

*Validation:*
How to get the validation errors from the annotated Entity into a form.


*Security.*
I would use DoctrineGuard in Symfony 1 for this. But I'm not sure if there's
a bundle for Symfony 2 yet, or if this is something I'm expected to build
myself.


*Cross bundle functionality.*
For example, taking the "Address" and "Person" example you gave, I would
like to create two views:


   - One for viewing an address, that would show all the people that use it
      - One for viewing a person, that would show all the addresses they use

Now I could build these views into each of the two bundles, but that would
create tight coupling between them. So I'm wondering if it would be wise to
create a third bundle called "Contact" that would create these views and
aggregate the functionality of the Address and Person bundles.

The problem being with this is that I don't think there's any way
to embellish the models in the Address and Person bundles to create the
references between them.


On Sat, Sep 18, 2010 at 11:38 AM, Richard D Shank <deve...@zestic.com>wrote:

>  Right now, the best thing to do is to look at other people's work.  Head
> over to http://symfony2bundles.org/ and look at some of the projects.
>
> On 09/17/2010 05:31 AM, Donald Tyler wrote:
>
> One thing I've noticed with the documentation (unless I'm just missing it),
> is that there seems to be documentation on the various parts of the
> framework (Validation, Forms, ORM etc), but no documentation on how to best
> integrate these pieces in a cohesive project.
>
>  For example, I'm not sure where I would define a model in the project,
> and if there would be one shared model, or if I'm supposed to be created a
> model for each bundle.
>
> I may be making a false assumption, but it might be helpful to find some
> articles on MVC (Model View Controller)
>
>
>  I'd appreciate it if anyone who is building a project in Symfony 2 could
> give me some pointers on how a real world project is structured. For
> example:
>
>  Model:
> Where do you store your model in your project?
>
> Generally, your model goes in your Bundle in an Entity folder for ORM and
> Document folder for ODM.
>
>  Do you break your model into different bundles?
>
> Personally, I try to keep related models together, but it really depends on
> what you are doing.  For example, if you are doing an address, you might
> have a model for regions and a model for countries.  It would make sense to
> have those in an AddressBundle, along with the model for the actual
> address.  However, if you are making a contact, it would use the address and
> a phone number, but those would probably all be in 3 separate bundles.
>
>
>  Forms:
> Do you create forms on the fly, or do you build form classes?
> Where do you store forms if you build classes for them?
>
> I haven't played with the forms enough to have any answers on this :).
>
>
>  If there's any blog posts or guide's online along these lines I'd
> appreciate a link to those too. I know it's a little early in Symfony 2's
> development for extensive documentation, but I'd like to start experimenting
> with at least a little guidance.
>
> Github is your friend.  Looking at code and reading the wikis for the
> projects are great sources for info.
>
>
>  - Donald
> --
> 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 users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>
>
>  --
> 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 users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to