<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matt Lawrence wrote:
<blockquote cite="mid:478B3462.4010907@ymogen.net" type="cite">
<pre wrap="">Angel Kolev wrote:
</pre>
<blockquote type="cite">
<pre wrap="">package AppModelDB::AppModel;
use base qw/DBIx::Class/; __PACKAGE__->belongs_to(archive =>
'AppModelDB::Schedules', 'id',, {join_type => 'left'}); <snip>
package AppModelDB::Schedules;
use base qw/DBIx::Class/; __PACKAGE__->has_many(model =>
'AppModelDB::AppModel', 'id'); <snip>
In my script:
$c->model('AppModelDB::Schedule')->find({id=>184})->delete;
This delete id 184 in AppModelDB::AppModel table too. Why? I dont use
delete_all.
</pre>
</blockquote>
<pre wrap=""><!---->find() returns a row, not a resultset. The delete method in
DBIx::Class::Row always cascades. I think that replacing find with
search here will give you your desired behaviour. If you never want
cascading deletions on that relationship, add { cascade_delete => 0 } as
a fourth argument to has_many.
Matt</pre>
</blockquote>
Thanks. <br>
<pre wrap="">{ cascade_delete => 0 } works, 'search' instead of 'find' not.</pre>
</body>
</html>