Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

copy in DBIX:Class

by palette (Scribe)
on Apr 16, 2007 at 06:08 UTC ( #610270=perlquestion: print w/replies, xml ) Need Help??

palette has asked for the wisdom of the Perl Monks concerning the following question:

I am using DBIx::Class in my project. I have defined a set of table and relation between them using DBIx::Class. Now I am trying to query the table 1 and fetching a record. I need to make duplicate of that record of table1. I am making use of the copy method in DBIx::Class.
But it seems DBIx::Class also take the relation with other table ie; table2 and also makes a copy of that table which in my case causes problem. I just wanted to make a copy of the table1 and not cascade the child tables. Can anyone tell me how can I acheive this.

Replies are listed 'Best First'.
Re: copy in DBIX:Class
by castaway (Parson) on Apr 16, 2007 at 12:39 UTC
    Set "cascade_copy => 0" in your relationship attributes, that will prevent it from copying them.


      __PACKAGE__->has_many(o=> 'DSLP2::Main::O','id',{cascade_copy=>0})

      will this work.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://610270]
Approved by friedo
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2023-05-30 23:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found