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 <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
