[Bast-commits] r9463 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun May 30 22:27:18 GMT 2010
Author: ribasushi
Date: 2010-05-30 23:27:18 +0100 (Sun, 30 May 2010)
New Revision: 9463
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
Log:
Fix MC double-object creation (important for e.g. IC::FS which otherwise leaves orphaned files)
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2010-05-30 22:25:01 UTC (rev 9462)
+++ DBIx-Class/0.08/trunk/Changes 2010-05-30 22:27:18 UTC (rev 9463)
@@ -32,7 +32,10 @@
- update() on row not in_storage no longer throws an exception
if there are no dirty columns to update (fixes cascaded update
annoyances)
- - Update Schema::Versioned to respect hashref style of connection_info
+ - Update Schema::Versioned to respect hashref style of
+ connection_info
+ - Do not recreate the same related object twice during MultiCreate
+ (solves the problem of orphaned IC::FS files)
* Misc
- Add a warning to load_namespaces if a class in ResultSet/
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm 2010-05-30 22:25:01 UTC (rev 9462)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm 2010-05-30 22:27:18 UTC (rev 9463)
@@ -405,19 +405,14 @@
my $reverse = $source->reverse_relationship_info($relname);
foreach my $obj (@cands) {
$obj->set_from_related($_, $self) for keys %$reverse;
- my $them = { %{$obj->{_relationship_data} || {} }, $obj->get_inflated_columns };
if ($self->__their_pk_needs_us($relname)) {
if (exists $self->{_ignore_at_insert}{$relname}) {
MULTICREATE_DEBUG and warn "MC $self skipping post-insert on $relname";
- } else {
- MULTICREATE_DEBUG and warn "MC $self re-creating $relname $obj";
- my $re = $self->result_source
- ->related_source($relname)
- ->resultset
- ->create($them);
- %{$obj} = %{$re};
- MULTICREATE_DEBUG and warn "MC $self new $relname $obj";
}
+ else {
+ MULTICREATE_DEBUG and warn "MC $self inserting $relname $obj";
+ $obj->insert;
+ }
} else {
MULTICREATE_DEBUG and warn "MC $self post-inserting $obj";
$obj->insert();
More information about the Bast-commits
mailing list