On 02/02/2015 05:53 PM, Luca Ferrari wrote:
So far, what I've done is to "emulate" the set method as follows:

...

and therefore delete each joined object

I think you are missing the fact that resultsets are strictly additive. Thus $some_object->some_has_many->delete will do *exactly* what you expect (delete all the related pieces of the has_many that relates to $some_object).

The following also works as you'd expect:

$schema->resultset('Something')
        ->search({ some arbitrary conditions })
         ->search_related('SomeHasManys')
          ->delete;

Does this answer the question?

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to