1 package CatalystX::DynamicComponent::ModelToControllerReflector::Strategy::InterfaceRoles;
3 use MooseX::Types::Moose qw/HashRef/;
5 use List::MoreUtils qw/uniq/;
6 use namespace::autoclean;
8 with 'CatalystX::DynamicComponent::ModelToControllerReflector::Strategy';
10 sub get_reflected_method_list {;
11 my ($self, $app, $model_meta) = @_;
12 my $model_name = $model_meta->name;
13 my $model_config = exists $app->config->{$model_name} ? $app->config->{$model_name} : {};
14 my $my_config = exists $app->config->{'CatalystX::DynamicComponent::ModelToControllerReflector'}
15 ? $app->config->{'CatalystX::DynamicComponent::ModelToControllerReflector'} : {};
16 my $interface_roles = [ uniq( map { (defined $_ && exists $_->{interface_roles}) ? $_->{interface_roles}->flatten : () } $model_config, $my_config ) ];
18 map { $_->meta->get_required_method_list } @$interface_roles;
21 __PACKAGE__->meta->make_immutable;