perl - How to change name of relationships created by dbicdump -


i have couple of tables like:

  • user
  • user_address -> fk users

and i'm generating dbic schema using dbicdump. creates following relationship in user.pm:

__package__->has_many(    "user_addresses",    "world::dbic::result::useraddress",    { "foreign.user_id" => "self.id" },    { cascade_copy => 0, cascade_delete => 0 }, ); 

is possible change name of relationship "addresses"? how? (i meant without changing code before # not modify or above!)

if not, there way make alias relationship?

have @ rel_name_map in dbix::class::schema::loader::base. should able when create schema:

my %args = (      use_moose      => 1,     use_namespaces => 1,     rel_name_map   => { user_addresses => 'addresses' },     # more args here... );  make_schema_at( 'my::schema', \%args, [ $connect_arg ... ] ); 

the rel_name_map important one, i've added few more lines context.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -