On 8/5/06 7:36 PM, Danial Pearce wrote: > On 8/2/06, John Siracusa <[EMAIL PROTECTED]> wrote: >> On 8/1/06 6:43 PM, Danial Pearce wrote: >>> create table foo ( >>> id serial not null, >>> foo text, >>> primary key (id) >>> ); >>> >>> create table bar ( >>> foo_id int references foo(id), >>> bar text, >>> primary key (foo_id) >>> ); >> >> In this situation, it shouldn't die on a call to $foo->bar, regardless of >> the referential_integrity setting on the relationship. The fact that it >> does so now is a bug. I'll fix it in the next release. > > If this is the case, I'm curious as to what the expected usage of the > referential_integrity is?
Look at the docs in SVN. Now only foreign keys have a referential_integrity attribute, and it works as you'd expect. The attribute on ...-to-one relationships is now called "required" (with an inverse attribute called "optional") which avoids overloading established terminology. Also, the default value of the "required" attribute is now determined by these rules: "The default is false if one or more of the local columns allow null values or if the local columns in the column map are the same as the primary key columns, true otherwise." In the foo->bar relationship in the above tables, the "local" (foo-resident) column in the relationship is the same as the primary key column: id. So the "required" attribute is false by default for that relationship. > I also notice the select to find $foo->bar gets run every time. DIdn't > find it the first time, then when you ask for $foo->bar again it goes > to look again. I guess that's fair, cos it's entirely possible that > one may have arrived in the mean time. Right, and if you just want to know if it was fetched already, use the (new in SVN) has_loaded_related() helper method. if ($foo->has_loaded_related('bar')) { ... } -John ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object