Re: May or may not have one relationship

2008-09-29 Thread grigri

Doesn't really seem much point.

When retrieving an `Entity`, cake will as for the join to be performed
so that both entries will be retrieved in a single query.

To only retrieve the `User` on a condition in the `Entity` table,
you'd have to first retrieve the `Entity` and then (sometimes)
retrieve the `User`. The overhead of a separate query is much higher
than a join that will never happen, assuming your tables are indexed
correctly.

You can always conditionally delete the empty User() array from the
results in afterFind(), if you feel it's necessary.

hth
grigri

On Sep 28, 9:15 am, Novice Programmer [EMAIL PROTECTED]
wrote:
 Hello All,

 This might be an awkward situation but for my current project i am having a
 situation where a table Entity may or not have a user. In the entities table
 there is a field which tells me whether there is some user associated with
 it or not. I want to handle the situation with cake php so that it tries to
 join Entity with User only when that particular field in entity is set. Is
 there some out there to help me?

 --
 Thanks  Regards,
 Novice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---



Re: May or may not have one relationship

2008-09-29 Thread Novice Programmer
Polymorphic behavior on bakery helped me .. just fyi.. in case some one else
is also stuck in such a situation.

Thanks.

On Mon, Sep 29, 2008 at 1:15 PM, grigri [EMAIL PROTECTED] wrote:


 Doesn't really seem much point.

 When retrieving an `Entity`, cake will as for the join to be performed
 so that both entries will be retrieved in a single query.

 To only retrieve the `User` on a condition in the `Entity` table,
 you'd have to first retrieve the `Entity` and then (sometimes)
 retrieve the `User`. The overhead of a separate query is much higher
 than a join that will never happen, assuming your tables are indexed
 correctly.

 You can always conditionally delete the empty User() array from the
 results in afterFind(), if you feel it's necessary.

 hth
 grigri

 On Sep 28, 9:15 am, Novice Programmer [EMAIL PROTECTED]
 wrote:
  Hello All,
 
  This might be an awkward situation but for my current project i am having
 a
  situation where a table Entity may or not have a user. In the entities
 table
  there is a field which tells me whether there is some user associated
 with
  it or not. I want to handle the situation with cake php so that it tries
 to
  join Entity with User only when that particular field in entity is set.
 Is
  there some out there to help me?
 
  --
  Thanks  Regards,
  Novice.
 



-- 
Thanks  Regards,
Novice.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---



May or may not have one relationship

2008-09-28 Thread Novice Programmer
Hello All,

This might be an awkward situation but for my current project i am having a
situation where a table Entity may or not have a user. In the entities table
there is a field which tells me whether there is some user associated with
it or not. I want to handle the situation with cake php so that it tries to
join Entity with User only when that particular field in entity is set. Is
there some out there to help me?

-- 
Thanks  Regards,
Novice.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---