Miachel, Good question - you will actually find the first few chapters of the book explain each part of the MVC model - and what part of your code should go where. I strongly recommend you have a read of the first few chapters of the book to see where is the best place to place what.
Agree with Lee - store CartID in the Session, never pass it through on the form, or otherwise anyone could fake someone else's cartID. Sherif On Nov 21, 4:43 am, Michal G <[EMAIL PROTECTED]> wrote: > Hello, > > Are there somewhere some good designs patterns how to write in > symfony? > > I mean something like - what should be done in controller(action), > form, in model. Something like Call the expert: refactoring story on > symfony blog page. > > For example i have a such problem - there's a shopping cart which > contains products (every product has a cart id). Every user has only > one active cart at one moment. Product is inserted into database by > symfony form. Now i need to check if form contains valid cart id (his > active cart). Should i do this validation in form validation or in > product model (for example pre insert event)? > > I don't know if it's good to do this in model, because then model is > coupled with session object (i need to check if cart belongs to user), > but on the other side it's safer because it's done on the lowest level > of application, near database. So i don't need to worry if someone > creates new product in another place of my application. > > How to solve such problems? How and where to look for such patterns. I > know that after some time i will gain experience in such things, but i > would like to do it sooner than later ;) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---