Allow using all the moniker parts in hashref moniker_map
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBObject.pm
index 1e6df30..a4a9e2c 100644 (file)
@@ -35,6 +35,7 @@ __PACKAGE__->mk_group_accessors(simple => qw/
 
 use overload
     '""' => sub { $_[0]->name },
+    '@{}' => sub { $_[0]->name_parts },
     fallback => 1;
 
 =head2 new
@@ -153,6 +154,20 @@ sub dbic_name {
     return $self->name;
 }
 
+=head2 name_parts
+
+Returns an arrayref of the values returned by the methods specified in
+the L<moniker_parts|DBIx::Class::Scheam::Loader::Base/moniker_parts> of
+the L</loader> object. The object arrayrefifies to this value.
+
+=cut
+
+sub name_parts {
+    my ($self) = shift;
+    return [ map { $self->$_ } @{$self->loader->moniker_parts} ];
+}
+
+
 =head1 SEE ALSO
 
 L<DBIx::Class::Schema::Loader::Table>, L<DBIx::Class::Schema::Loader>,