In a client application I have a DBIx::Class model ‘Todo’ that can be linked to a number of other models using a many-to-many relation.
I know, because of business logic, that 1 and only 1 foreign model is linked to it. I want to fetch that model in my query using:
my $objects = $c->model('DB')->resultset('Todo')->search($myFilter,{
prefetch => \@relations # contains all possible relations
});
Like the documentation states DBIx::Class::ResultSource warns about this:
DBIx::Class::ResultSet::next(): Prefetching multiple has_many rels accountbalances_todos and accounts_todos at top level will explode the number of row objects retrievable via ->next or ->all. Use at your own risk. at /media/psf/projects/.../Controller/Todo.pm line 117
Can anyone tell me how to prevent this error without resorting to editing DBIx::Class::ResultSource itself? I see no other way of doing what I want and want to prevent the application dumping a lot of warnings in the log. I have tried fiddling with @CARP_NOT and $Carp::Internal, but cannot get Carp from skipping this warning (the documentation on this is sparse at best)
If anyone could help me that would be awesome, thanks
You could override the default handling of warning signals to catch and ignore this specific warning:
or, if you prefer,