[Bast-commits] r9213 - in DBIx-Class-Tree/trunk: .
lib/DBIx/Class/Tree t/lib
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Apr 25 16:31:37 GMT 2010
Author: ribasushi
Date: 2010-04-25 17:31:37 +0100 (Sun, 25 Apr 2010)
New Revision: 9213
Modified:
DBIx-Class-Tree/trunk/Changes
DBIx-Class-Tree/trunk/lib/DBIx/Class/Tree/AdjacencyList.pm
DBIx-Class-Tree/trunk/t/lib/TreeTest.pm
Log:
Fix copy
Modified: DBIx-Class-Tree/trunk/Changes
===================================================================
--- DBIx-Class-Tree/trunk/Changes 2010-04-25 16:29:07 UTC (rev 9212)
+++ DBIx-Class-Tree/trunk/Changes 2010-04-25 16:31:37 UTC (rev 9213)
@@ -1,6 +1,9 @@
Revision history for DBIx::Class::Tree
+ - Fixed the parents (note the plural) relationship to
+ not have cascade_copy set by default
+
0.03000 2009-08-18
- Removed EXPERIMENTAL flags, because after 2 years there'd be bugs
if there were any serious problems. (Ian Wells)
Modified: DBIx-Class-Tree/trunk/lib/DBIx/Class/Tree/AdjacencyList.pm
===================================================================
--- DBIx-Class-Tree/trunk/lib/DBIx/Class/Tree/AdjacencyList.pm 2010-04-25 16:29:07 UTC (rev 9212)
+++ DBIx-Class-Tree/trunk/lib/DBIx/Class/Tree/AdjacencyList.pm 2010-04-25 16:31:37 UTC (rev 9213)
@@ -85,7 +85,7 @@
my $primary_col = ($class->primary_columns())[0];
$class->belongs_to( '_parent' => $class => { "foreign.$primary_col" => "self.$parent_col" } );
$class->has_many( 'children' => $class => { "foreign.$parent_col" => "self.$primary_col" } );
- $class->has_many( 'parents' => $class => { "foreign.$primary_col" => "self.$parent_col" }, { cascade_delete => 0 } );
+ $class->has_many( 'parents' => $class => { "foreign.$primary_col" => "self.$parent_col" }, { cascade_delete => 0, cascade_copy => 0 } );
$class->_parent_column( $parent_col );
return 1;
}
Modified: DBIx-Class-Tree/trunk/t/lib/TreeTest.pm
===================================================================
--- DBIx-Class-Tree/trunk/t/lib/TreeTest.pm 2010-04-25 16:29:07 UTC (rev 9212)
+++ DBIx-Class-Tree/trunk/t/lib/TreeTest.pm 2010-04-25 16:31:37 UTC (rev 9213)
@@ -29,11 +29,6 @@
$node->parent( $parent_id );
}
- lives_and ( sub {
- warn "BEGIN!!!!!\n\n";
- is( $nodes->find(3)->copy({name => 'special'})->name,'special','copy test');
- }, 'copy does not throw');
-
ok( ($nodes->count()==81), 'correct number of nodes in random tree' );
ok( ($nodes->find(3)->children->count()==7), 'node 3 has correct number of children' );
ok( ($nodes->find(22)->children->count()==3), 'node 22 has correct number of children' );
@@ -59,6 +54,10 @@
if( TreeTest::Schema::Node->can('position_column') ){
ok( check_positions(scalar $root->children()), 'positions are correct' );
}
+
+ lives_and ( sub {
+ is( $nodes->find(3)->copy({name => 'special'})->name,'special','copy test');
+ }, 'copy does not throw');
}
sub check_positions {
More information about the Bast-commits
mailing list