0ca085ba82a798689c2ef3c0c35fb404442d97c3
[catagits/Catalyst-Controller-DBIC-API.git] / lib / Catalyst / Controller / DBIC / API / Request / Context.pm
1 package Catalyst::Controller::DBIC::API::Request::Context;
2
3 #ABSTRACT: Provides additional context to the Request
4 use Moose::Role;
5 use MooseX::Types::Moose(':all');
6 use MooseX::Types::Structured('Tuple');
7 use Catalyst::Controller::DBIC::API::Types(':all');
8 use namespace::autoclean;
9
10 =attribute_public objects is:
11     ro
12     isa ArrayRef[Tuple[Object,Maybe[HashRef]]]
13     traits: ['Array']
14
15 This attribute stores the objects found/created at the object action.
16 It handles the following methods:
17
18     all_objects   => 'elements'
19     add_object    => 'push'
20     count_objects => 'count'
21     has_objects   => 'count'
22     clear_objects => 'clear'
23
24 =cut
25
26 has objects => (
27     is     => 'ro',
28     isa    => ArrayRef[Tuple[Object,Maybe[HashRef]]],
29     traits => ['Array'],
30     default => sub { [] },
31     handles => {
32         all_objects   => 'elements',
33         add_object    => 'push',
34         count_objects => 'count',
35         has_objects   => 'count',
36         clear_objects => 'clear',
37         get_object    => 'get',
38     },
39 );
40
41 =attribute_public current_result_set is:
42     ro
43     isa: L<Catalyst::Controller::DBIC::API::Types/ResultSet>
44
45 Stores the current ResultSet derived from the initial
46 L<Catalyst::Controller::DBIC::API::StoredResultSource/stored_model>.
47
48 =cut
49
50 has current_result_set => (
51     is     => 'ro',
52     isa    => ResultSet,
53     writer => '_set_current_result_set',
54 );
55
56 1;