[Dbix-class] Useful patch to DBIx::Class::Schema::Loader
Ben Tilly
btilly at gmail.com
Fri May 27 03:35:58 GMT 2011
I'm looking for feedback on a patch to DBIx::Class::Schema::Loader.
If people like it, I would like to see this added to the next release.
The patch adds a relationship_name_map argument to
DBIx::Class::Schema::Loader::Base to give people control over what
names will be given to relationships. A comment in the source
suggests that this was supposed to be implemented, but that never
seems to have happened.
As implemented, this argument can be a coderef or a hashref. If it is
a hashref, you can do things like:
{
bar =3D> "baz",
Foo =3D> {
bar =3D> "blat",
},
}
which will cause relationships that would have been called bar to be
called baz, except in class Foo where it will be called blat instead.
If a coderef you are given the moniker for the class being built, the
name of the relationship accessor, and then a hashref with more
detailed information.
This patch includes documentation and unit tests.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbix-class-schema-loader.patch
Type: application/octet-stream
Size: 14682 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110526/73=
f6728b/dbix-class-schema-loader.obj
More information about the DBIx-Class
mailing list