On 8/8/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 8, 2006, at 10:21 AM, Mark Quinn wrote:
>
> > The post controller does a recursive find to get a post and its
> > comments. However this returns a big fat array of all the required
> > data and does not use my yummy objects. I can read a specific database
> > field to find if something is approved or not, but this is not very
> > OO. I would like to add an "is_approved" method to my Comment object.
>
> Wouldn't this method just read the database field anyway?
>
> You might try associating your comments to your posts in two ways -
> one way that only grabs approved comments, and another that only
> grabs not-yet-approved comments. You can do this using the
> 'conditions' key of the hasMany array.
>
> This is ORM, so that's pretty object-friendly. :)

Sorry John, you missed my question. I knew it might be risky to simplify it.
This is a general design question. I don;t need to solve a specific
programming problem.

For the purposes of the question, lets assume that the model method
(previously known as "is_approved") requires a complex algorithm to be
computed. What would be the recommended way to work then?

My mental blocker fundamentally revolves round this:

We can be very OO and add lots of nice methods to our models (to do
simple or complex things), but if we use any of the model->find
variants to populate some data, we then can't use our nice new
methods, as the data is not returned  to us as objects.

How do I use my shiny new model methods and model->find (and its
friends) together ? And why don't methods like "find" return model
objects ?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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