On 8/5/06 9:44 AM, Danial Pearce wrote:
> On 8/5/06, John Siracusa <[EMAIL PROTECTED]> wrote:
>> I've rearranged the interface to this stuff a little bit in SVN, but
>> the results should still take care of your situation. If you get a
>> chance, try the SVN version and let me know if it correctly makes the
>> foo->bar relationship "optional" by default.
>
> Mine is dying when you have a completely new object, and you have your
> new object to create a new object in the relationship also.
Cascade on save really doesn't come into play with brand new objects.
They're handled by the existing get_set_on_save methods.
> Consider the following tables:
>
> create table foo ( id serial not null, foo text );
> create table bar ( foo_id int not null references foo(id), bar text);
Neither has a primary key, and RDBO requires every table to have one. But
I'll assume you meant this:
create table foos
(
id serial not null primary key,
foo text
);
create table bars
(
foo_id int not null primary key references foos (id),
bar text
);
Given those tables, this is what the Loader makes of them:
> And the code:
>
> my $bar = MyApp::Bar->new;
> my $foo = MyApp::Foo->bew;
> $foo->bar($bar);
> $foo->bar->bar('some text');
> $foo->save(cascade => 1);
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object