Thank you all for your responses, I will create my own bussiness classes and put them into the appropriate /lib folder. Maybe into the /lib/app or /lib/buss subfolder for better tidiness ;)
I have only one "problem" with this... I my previous system the layers can communicate only with closest layer -> controllers where restricted to communicate only with business(application) classes and with templates. So I knew that e.g. if something goes wrong when saving to db. I can debug by this way: controller -- bussiness class -- DAO class Now in symfony controllers work with models directly (I know that this is because active record - I'm using doctrine with symfony) and they will call methods from bussines classes for more complex procedures too... Don't you think it's a little messy? :) Do you have some system in that? e.g. Only models can call methods from bussines classes, or something like that? Or do you think it's no problem that controllers work with models directly and bussiness classes are called by controllers and work with models too? On 2 ún, 10:38, Gareth McCumskey <[email protected]> wrote: > Feel free to create your own classes as and when you need them. If > they need to be globally accessible classes from any application > create them in /lib. If they are only needed for one application (like > the frontend) store them in /apps/app_name/lib. Whenever you use them > in your code anywhere else symfony will autoload them. > > In our projects we create certain business logic portions in our > model, but only those that will access DB, so for example if you need > to extract certain records and return them in a certain format etc. > > On Tue, Feb 2, 2010 at 10:59 AM, Dheeraj Kumar Aggarwal > > > > > > <[email protected]> wrote: > > hi > > > According to your terminology, > > > i think you have used Spring framework with hibernate in java or another > > framework > > > In symfony, you first define your model layer schema in schema.yml > > then you can use propel or doctrine as a ORM to generate your model layer > > > i have used Propel > > > so in propel, it will create your model layer (containg getters and setters > > and CRUD operation and some other important functions) in om folder > > it also provides two custom classes per table to implement your custom > > business logic. > > > On Mon, Feb 1, 2010 at 5:46 AM, Tom Ptacnik <[email protected]> wrote: > > >> Hi, > > >> I want to ask you where you put complex application code when > >> developing with symfony (some bigger applications). > > >> When I don't develope with symfony faramework I've got this tiers: > > >> - Model classes (only beans - attributes and getters setters, this > >> class doesn't do anything by itself) > >> - DAO classes - store Models into database, creating models from > >> database ( add(), edit(), delete(), list(), ....) > >> - Application classes - application code - the logic of the > >> application which isn't suitable (too big/complicated, or wanted to be > >> reused) for controllers > >> - what to do when deleting object (e.g. I want to send an email > >> before, and delete two images), adding objects... > >> - application of user restrictions while accesing to the objects - > >> using DAO classes for accesing into database > >> - many methods names are same as those in DAO classes - insert(), > >> edit(), delete()..., but many of them do much more logic before > >> calling methods from DAO class > >> - Controllers - they create an application logic - call the methods of > >> the Application classes and send some objects and variables into > >> teplates (controllers call only Application classes, never DAO classes > >> directly) > >> - Templates (classic templates) > > >> So it's: Templates - Controllers - Application classes - DAO , and > >> this all tiers use a Model objects > > >> In symfony it's: Templates - Controllers - Model(objects and table > >> classes) > > >> If I have a simple application it's ok to put all app code into the > >> Models, but if I want to create a little bigger application I'm afraid > >> of "too fat Models" ... > > >> Where do you store more complicated application logic? Do you have it > >> all in the Models? > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "symfony users" 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-users?hl=en. > > > -- > > Regards, > > Dheeraj > > > -- > > You received this message because you are subscribed to the Google Groups > > "symfony users" 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-users?hl=en. > > -- > Gareth McCumskeyhttp://garethmccumskey.blogspot.com > twitter: @garethmcc -- You received this message because you are subscribed to the Google Groups "symfony users" 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-users?hl=en.
