Hi!
I've come across the same problem, using hasOne associations, but with
an extra problem.
in ModelA:
$hasOne = array('ModelB' => array('foreign_key' => 'model_b',
'conditions' =>
array('ModelA.some_field' => 'some_value')));
With this association, if recursive is larger than 1, Cake will try to
select from ModelB and will fail because it aplies the condition
ModelA.some_field = 'some_value' and ModelA isn't included in this
query.
With $recursive = 1 (or 0) everything works fine since only the LEFT
JOIN query is executed.
Best regards.
Gonçalo.
On Jul 16, 3:55 pm, Nick <[EMAIL PROTECTED]> wrote:
> > No private emails please. The bulk of your question is answered in the
> > first result of that search:
>
> Sorry, it was actually intended for the group.
>
> And thanks for the link. I think it was one that I'd seen already, but
> doesn't have an explanation other than a vague comment that the
> limitation "is required for Cake's Models to do their associative data
> mapping magic".
>
> Having multiple queries where there would be repeated data is
> certainly fair enough, but an algorithm to combine one to one mappings
> into a near optimal singlequeryshould be possible, particularly in
> the trivial case described. If it turned out to be to hard to get
> right in some cases when some other associations are involved for
> example, then provided that a schema can be determined to be simple or
> hairy, an appropriate algorithm could be selected as necessary.
>
> So it is a weakness, but not the end of the world as one can always
> use a handbuiltquerywithout too much effort.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---