[Dbix-class] Deleting with JOIN's

Drew Taylor taylor.andrew.j at gmail.com
Thu Oct 23 10:31:52 BST 2008


On Fri, Oct 17, 2008 at 4:17 PM, Yves Räber <yraber at mailup.net> wrote:
> And That's the piece of code that I'm trying to make work :
>
> my $extensions = $c->model('MyApp::Batch')->search(
> {
>  state => ['STOPPED', 'ARCHIVED', 'DONE']
> }
> )->search_related('script')->search_related('astextensions');
>
> Now if I try $extensions->delete , this is what I get (I have to admit I
> don't really understand why I get this):

I'm not a DBIC guru by any means, but I ran into a situation like this
recently where all the chained calls weren't being followed and the
solution was to run all methods (search->search->search in my case) in
a single call. Maybe try:
...->search_related('script')->search_related('astextensions')->delete;

Drew
-- 
----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew at drewtaylor.com  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------



More information about the DBIx-Class mailing list