Primarily to populate other relationships. So, for instance.

I have a two classes called 'Template' and 'Template::Version'.
Template has a one to many relationship with Template::Version 
(Template::Version has a foreign key into Template),
as well as a many to one relationship with Template::Version through 
'use_version_id', (which usually contains the most recent template version, but 
not always). 

I would like to be able to do....

use Template;
my $template = Template->new( name => 'blah blah!' );
my ($newversion) = $template->add_versions({value => 'xxyy', digest => 
'dasfwgwqw'});
$template->use_version($newversion);
$template->save;

Right now, I have to explicitly know the class and all attributes of 
Template::Version to do this, i.e.

use Template;
use Template::Version;

my $template = Template->new( name => 'blah blah!' );
my $newversion = Template::Version->new( template => $template, value => 
'xxyy', digest => 'dasfwgwgw' );
$template->add_versions($newversion);
$template->use_version($newversion);
$template->save;

It just feels clumsy, and requires more hardcoded knowledge than I would like 
at this level of abstraction.
Seems easy to correct as well?


I guess the question I should ask is:
  Why NOT return the newly created objects? 


On Wed, May 10, 2006 at 02:43:11PM -0400, John Siracusa wrote:
> On 5/10/06, Jesse Brown <[EMAIL PROTECTED]> wrote:
> >When adding objects to a relationship via $object->add_<relationship>({ 
> >blah
> >=> 1, etc}), I seem unable to get back the list of objects that were 
> >created
> >and added to the relationship, which seems like it would be VERY 
> >convenient?
> >
> >It also seems that the behaviour of: returning the number of items added in
> >scalar context, and a list of created objects when in list context would be
> >easy to add, and not break existing code.
> 
> What do you plan to do with the objects returned, or with the count
> for that matter?  Surely you know the count when you make the call
> because you know how many arguments you're passing.  What's your usage
> scenario?
> 
> -John
> 
> 
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
> _______________________________________________
> Rose-db-object mailing list
> Rose-db-object@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rose-db-object






-----------------------------------------------------------
This message may contain confidential and/or privileged 
information. This information is intended to be read only
by the individual or entity to whom it is addressed. If
you are not the intended recipient, you are on notice that
any review, disclosure, copying, distribution or use of
the contents of this message is strictly prohibited. If
you have received this message in error, please notify the
sender immediately and delete or destroy any copy of this
message.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to