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

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:

Hi
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.

    C.

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

      will this work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://610270]
Approved by friedo
help
Chatterbox?
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
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?