On 9/25/06, temm <[EMAIL PROTECTED]> wrote:
>
> I do all job in controllers and use models only for something like this
> <?php
> class Book extends AppModel
> {
>  var $name = 'Book';
> }
> ?>
> As far as I know model should contain main logic but what does it mean
> in practice?

Hey temm,

Under the MVC model that most people associate with web frameworks
like Cake, all your logic *should* be in the controller and all the
model is doing is providing you with data to manipulate and provide to
your views.  I always try to have my models provide me with the raw
data so I can keep all my logic that alters the data in one place.

When you create an object that extends Model, there is lots of
"business logic" going on in the background to produce the results
sets you get back.  There's no reason why you can't create a model
that does some work on the results before it passes it to the
controller making the call on the model.

There's no *right* way to do MVC, just the concept of separating your
business logic from your presentation logic.  Hope that helps.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to