[Dbix-class] Should new_related update _rel_in_storage and
friends?
Matt S Trout
dbix-class at trout.me.uk
Wed Oct 3 21:21:08 GMT 2007
On Mon, Oct 01, 2007 at 11:19:18AM +0100, Scott Thomson wrote:
> Hi All,
>
> In Row::new there is logic for caching newed but not inserted objects
> so that insert can pick them up later and insert them if required.
>
> Are there any technical/theoretical reasons for not simulating or
> moving the logic into Relationship::Base::new_related?
>
> E.g. I think the following should work but it currently doesn't ...
>
> my $obj1 = $schema->resultset('MyApp::Obj1')->new($some_args);
> my $obj2 = $obj1->new_related('rel', $more_args);
> $obj1->insert();
> ok($obj2->in_storage());
I don't think the new_related implies you want it to be inserted when the
other object is.
Setting it as $obj1->rel($obj2) before the insert OTOH, probably does.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list