Yes exactly. I tried the expects() and it works like a charm. When
recursive calls get too deep, the replicated queries get really scary.
On top of that half the time we will not be using most of the data
returned as well. It will be really sweet if there is a way to not
just specify the Model required but also the fields required.

My main question was with such problems, will you guys prefer to not
add any association on the Model itself. But use bindModel in your
Model and specify the fields required to retrieve the data. This way,
you will not be returned with huge amount of data which you do not
actually need. It will be sweet if somehow expects() can accept the
keys "conditions" and "fields" as well.

The another question I was trying to bring up is that in my example,
Application belongsTo User and User hasOne Profile. Will you guys
actually do things like:

bindModel(array(
    'belongsTo/hasOne' => array(
        'Profile' => array(
            'foreignKey' => 'user_id'
        )
    )
)

This will "link" Application direct to the Profile using the user_id
field and thus, cake will then LEFT JOIN the Profile instead of making
separate queries. Of course, the no longer forces the actual
relationship of the models. What say you? Good or Bad practice?

On Apr 9, 7:50 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
> > I've used expects() and in my opinion, should become a core feature of
> > CakePHP. It feels a lot more natural than the bind and unbinding of
> > associations. It's succinct. And because it's built on top of the bind/
> > unbind approach, you can still use it if necessary.
>
> +1. I could not imagine dealing with big databases without some kind of
> Model::expects or unbindAllExcept function. It's very useful indeed.
>
> -- Felix
> --------------------------http://www.thinkingphp.orghttp://www.fg-webdesign.de
>
> jonathan.snook wrote:
> > On Apr 9, 12:01 am, "Mariano Iglesias" <[EMAIL PROTECTED]>
> > wrote:
>
> >> This sounds like a scream for help, and expects() is up to the challenge ;)
>
> >>http://bakery.cakephp.org/articles/view/185
>
> > I've used expects() and in my opinion, should become a core feature of
> > CakePHP. It feels a lot more natural than the bind and unbinding of
> > associations. It's succinct. And because it's built on top of the bind/
> > unbind approach, you can still use it if necessary.


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to