[RDBO] setting up a new object with a related child ?

2006-10-13 Thread Jonathan Vanasco
I have essentially an inherited table... Class A col 1 col 2 col 3 Class B col 11 PRIMARY KEY REFERENCES col 1 col 12 col 13 Rose has them in a 1:1 relationship Loading is fine

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread Jonathan Vanasco
Right now I have this: $classAB= Rose::DB::Object::Manager-get_objects( object_class= A with_objects= ['B'], query= [ id= $kw_args{'id'} ,

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread John Siracusa
On 10/13/06, Jonathan Vanasco [EMAIL PROTECTED] wrote: Right now I have this: $classAB= Rose::DB::Object::Manager-get_objects( object_class= A with_objects= ['B'], query= [

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread Jonathan Vanasco
On Oct 13, 2006, at 4:09 PM, John Siracusa wrote: Then why not just do this: $a = A-new(id = 123); $b = B-new(id = 123); $a-b($b); $a-save; # save A and its associated B That's actually exactly what I wanted. I couldn't figure out if rose supported that or not.

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread John Siracusa
On 10/13/06, Jonathan Vanasco [EMAIL PROTECTED] wrote: On Oct 13, 2006, at 4:09 PM, John Siracusa wrote: Then why not just do this: $a = A-new(id = 123); $b = B-new(id = 123); $a-b($b); $a-save; # save A and its associated B That's actually exactly what I wanted. I

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread Jonathan
On Oct 13, 2006, at 4:33 PM, John Siracusa wrote: It does :) Read up on the get_set_on_save variants of the methods created for the various relationship types. In this case, a one-to-one relationship, the default automatically created method types:

Re: [RDBO] setting up a new object with a related child ?

2006-10-13 Thread John Siracusa
On 10/13/06 10:05 PM, Jonathan wrote: On Oct 13, 2006, at 4:33 PM, John Siracusa wrote: $a = A-new(id = 123); $b = B-new(id = 123); $a-b($b); that $a-b() part -- i didn't think rose could do that. the docs didn't make it clear that you can just stuff a relationship object