I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2009-12-23 15:47:32-08 by maelink
PB with multiple has_many and cascade deletion
Hi, I am currently migrating a project to Catalyst + DBIx::Class and I am afraid there is no way to fully propagate cascade deletion trough a table which has more than one association 'has_many' .. Ex. :
package solution::Schema::solutionDB::Servers; use strict; use warnings; use base 'DBIx::Class'; # .. ___PACKAGE__->belongs_to( reseller => 'solution::Schema::solutionDB::Resellers', ); # .. _PACKAGE__->has_many( ref => 'solution::Schema::solutionDB::ServersAv', 'server_ref', { cascading_delete => 1 } ); __PACKAGE__->has_many( ref => 'solution::Schema::solutionDB::ServersOptions', 'server_ref', { cascading_delete => 1 }, ); # # EOF
--> A call to delete_all() on the table 'Resellers' normally propagates to table 'Servers' BUT only delete entries in the table 'ServersOptions' (associated in THE LAST block 'has_many'). If I invert those two blocks, entries are not deleted from table 'ServersOptions' but from table 'ServersAv' (??!!) It seems that a call to has_many() simply overwrites previous one !? Did I miss something ? Thank for your help
Direct Responses: Write a response