package Catalyst::Controller::DBIC::API::StoredResultSource;
-#ABSTRACT: Provides acessors for static resources
+#ABSTRACT: Provides accessors for static resources
use Moose::Role;
use MooseX::Types::Moose(':all');
has 'class' => ( is => 'ro', isa => Str, writer => '_set_class' );
-=attribute_public stored_result_source is: ro, isa: L<Catalyst::Controller::DBIC::API::Types/ResultSource>
+=attribute_public result_class is: ro, isa: Str
-This is the result source for the controller
+result_class is the name of the resultset class that is the model for this controller
=cut
-has 'stored_result_source' =>
-(
- is => 'ro',
- isa => ResultSource,
- lazy_build => 1,
-);
+has 'result_class' => ( is => 'ro', isa => Str, default => 'DBIx::Class::ResultClass::HashRefInflator' );
-=attribute_public stored_model is: ro, isa: L<Catalyst::Controller::DBIC::API::Types/Model>
+=method_public stored_result_source
-This is the model for the controller
+This is the result source for the controller
=cut
-has 'stored_model' =>
-(
- is => 'ro',
- isa => Model,
- lazy_build => 1,
-);
-
-sub _build_stored_model
-{
- return $_[0]->_application->model($_[0]->class);
+sub stored_result_source
+{
+ return shift->stored_model->result_source;
}
-sub _build_stored_result_source
+=method_public stored_model
+
+This is the model for the controller
+
+=cut
+
+sub stored_model
{
- return shift->stored_model->result_source();
+ return $_[0]->_application->model($_[0]->class);
}
=method_public check_has_column
sub check_has_relation
{
my ($self, $rel, $other, $nest, $static) = @_;
-
+
$nest ||= $self->stored_result_source;
if(HashRef->check($other))
=method_public check_column_relation
-Convenience method to first check if the provided argument is a valid relation (if it is a HashRef) or column.
+Convenience method to first check if the provided argument is a valid relation (if it is a HashRef) or column.
=cut
sub check_column_relation
{
my ($self, $col_rel, $static) = @_;
-
+
if(HashRef->check($col_rel))
{
try