[CDBI] delete from lookup table
peterspeltz at gmail.com
Wed Oct 26 20:27:52 BST 2005
On 10/25/05, WulfDirk.Leuschner at sanofi-aventis.com
<WulfDirk.Leuschner at sanofi-aventis.com> wrote:
> Hi all,
> is there a method that deletes entries from a lookup table in a many-to-many
> relationship? Some autogenerated method similar to 'add_to_<my_method>
> [which could be called 'remove_from_<my_method>]?
What i have seen a lot is is the use or "delete_all" on the results
from a search.
$class->search( id => $related_id)->delete_all;
and if a "my_method" is a has_many accessor i think you can say;
$self->my_method(id => $id)->delete_all;
I'm not sure if has_many method will return an iterator in scalar
context or not.
More information about the ClassDBI