Commit | Line | Data |
d2739840 |
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 | |
c0c8e1c6 |
10 | =attribute_public objects |
d2739840 |
11 | |
8ea592cb |
12 | This attribute stores the objects found/created at the object action. |
13 | It handles the following methods: |
d2739840 |
14 | |
8ea592cb |
15 | all_objects => 'elements' |
16 | add_object => 'push' |
d2739840 |
17 | count_objects => 'count' |
8ea592cb |
18 | has_objects => 'count' |
d2739840 |
19 | clear_objects => 'clear' |
20 | |
21 | =cut |
22 | |
8ea592cb |
23 | has objects => ( |
24 | is => 'ro', |
25 | isa => ArrayRef[Tuple[Object,Maybe[HashRef]]], |
26 | traits => ['Array'], |
d2739840 |
27 | default => sub { [] }, |
8ea592cb |
28 | handles => { |
29 | all_objects => 'elements', |
30 | add_object => 'push', |
d2739840 |
31 | count_objects => 'count', |
8ea592cb |
32 | has_objects => 'count', |
d2739840 |
33 | clear_objects => 'clear', |
8ea592cb |
34 | get_object => 'get', |
d2739840 |
35 | }, |
36 | ); |
37 | |
c0c8e1c6 |
38 | =attribute_public current_result_set |
d2739840 |
39 | |
8ea592cb |
40 | Stores the current ResultSet derived from the initial |
41 | L<Catalyst::Controller::DBIC::API::StoredResultSource/stored_model>. |
d2739840 |
42 | |
43 | =cut |
44 | |
8ea592cb |
45 | has current_result_set => ( |
46 | is => 'ro', |
47 | isa => ResultSet, |
d2739840 |
48 | writer => '_set_current_result_set', |
49 | ); |
50 | |
51 | 1; |