Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-08 Thread Nancy

I'm not exactly sure how to do this in Cake but it sounds like you
want a left join, so that if there's no match you'll get back the row
but nulls in the unmatched row.  With a normal join you'd get nothing
back.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-07 Thread brian

Yeah, it's a DB thing. In Cake terms, I think it'd be covered by
belongsTo, as you suggested.

On Sat, Feb 7, 2009 at 10:04 AM, WebbedIT  wrote:
>
> How does that differ from belongsTo?  Or is this discussing
> relationships at db level rather than cake model association?
> >
>

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-07 Thread WebbedIT

How does that differ from belongsTo?  Or is this discussing
relationships at db level rather than cake model association?
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-07 Thread Webweave

Just means that there is a child table that has at most one row that
is related to the parent, but also could have none.

On Feb 7, 1:53 am, WebbedIT  wrote:
> Forgive me for asking what seems a dumb question .. but what is a zero
> to one relationship (don't snigger too loudly ... but I'll never learn
> by being too embarrassed to ask!)
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-07 Thread WebbedIT

Forgive me for asking what seems a dumb question .. but what is a zero
to one relationship (don't snigger too loudly ... but I'll never learn
by being too embarrassed to ask!)
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database question, How do I represent a zero in a zero to one relationship?

2009-02-06 Thread mscdex

You should use a null value in the foreign key field to represent that
that row doesn't participate in a relationship with the other model.

On Feb 6, 12:54 pm, TonyP  wrote:
> I need to create a zero to one relationship for my cakephp app. I
> would like to have a foreign key constraint, cascade on update.
>
> The problem is, when I use zero as the default value for the field, I
> get a foreign key constraint error when trying to add the constraint.
> This is because there is no zero value for the constraint I'm adding.
>
> My question is, should I use a Null value to represent the zero is my
> zero to one relationship? Or, should I just create a zero value for
> the primary key in the foreign table?
>
> For example, creating an entry
>
> id = 0
> company_name = "no company"
> phone = " "
> ect ...
>
> I read about there being performance problems when using null values?
> Does anyone have any incite?
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Database question, How do I represent a zero in a zero to one relationship?

2009-02-06 Thread TonyP

I need to create a zero to one relationship for my cakephp app. I
would like to have a foreign key constraint, cascade on update.

The problem is, when I use zero as the default value for the field, I
get a foreign key constraint error when trying to add the constraint.
This is because there is no zero value for the constraint I'm adding.

My question is, should I use a Null value to represent the zero is my
zero to one relationship? Or, should I just create a zero value for
the primary key in the foreign table?

For example, creating an entry

id = 0
company_name = "no company"
phone = " "
ect ...

I read about there being performance problems when using null values?
Does anyone have any incite?
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---