]>
Commit | Line | Data |
---|---|---|
4ed3f8e7 MG |
1 | use utf8; |
2 | package Gruntmaster::Data::Result::ContestProblem; | |
3 | ||
4 | # Created by DBIx::Class::Schema::Loader | |
5 | # DO NOT MODIFY THE FIRST PART OF THIS FILE | |
6 | ||
7 | =head1 NAME | |
8 | ||
be2f7678 | 9 | Gruntmaster::Data::Result::ContestProblem - Many-to-many bridge between contests and problems |
4ed3f8e7 MG |
10 | |
11 | =cut | |
12 | ||
13 | use strict; | |
14 | use warnings; | |
15 | ||
16 | use base 'DBIx::Class::Core'; | |
17 | ||
18 | =head1 TABLE: C<contest_problems> | |
19 | ||
20 | =cut | |
21 | ||
22 | __PACKAGE__->table("contest_problems"); | |
23 | ||
24 | =head1 ACCESSORS | |
25 | ||
26 | =head2 contest | |
27 | ||
28 | data_type: 'text' | |
29 | is_foreign_key: 1 | |
30 | is_nullable: 0 | |
31 | ||
32 | =head2 problem | |
33 | ||
34 | data_type: 'text' | |
35 | is_foreign_key: 1 | |
36 | is_nullable: 0 | |
37 | ||
38 | =cut | |
39 | ||
40 | __PACKAGE__->add_columns( | |
41 | "contest", | |
42 | { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, | |
43 | "problem", | |
44 | { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, | |
45 | ); | |
46 | ||
47 | =head1 PRIMARY KEY | |
48 | ||
49 | =over 4 | |
50 | ||
51 | =item * L</contest> | |
52 | ||
53 | =item * L</problem> | |
54 | ||
55 | =back | |
56 | ||
57 | =cut | |
58 | ||
59 | __PACKAGE__->set_primary_key("contest", "problem"); | |
60 | ||
61 | =head1 RELATIONS | |
62 | ||
63 | =head2 contest | |
64 | ||
65 | Type: belongs_to | |
66 | ||
67 | Related object: L<Gruntmaster::Data::Result::Contest> | |
68 | ||
69 | =cut | |
70 | ||
71 | __PACKAGE__->belongs_to( | |
72 | "contest", | |
73 | "Gruntmaster::Data::Result::Contest", | |
74 | { id => "contest" }, | |
9bb39921 | 75 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, |
4ed3f8e7 MG |
76 | ); |
77 | ||
78 | =head2 problem | |
79 | ||
80 | Type: belongs_to | |
81 | ||
82 | Related object: L<Gruntmaster::Data::Result::Problem> | |
83 | ||
84 | =cut | |
85 | ||
86 | __PACKAGE__->belongs_to( | |
87 | "problem", | |
88 | "Gruntmaster::Data::Result::Problem", | |
89 | { id => "problem" }, | |
9bb39921 | 90 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, |
4ed3f8e7 MG |
91 | ); |
92 | ||
93 | ||
be2f7678 MG |
94 | # Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:44:22 |
95 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dTFBC3ZKB2T9SCiyQxxe2w | |
4ed3f8e7 | 96 | |
de7226ca MG |
97 | use Class::Method::Modifiers qw/after/; |
98 | ||
a2aa46e6 MG |
99 | sub rawcontest { shift->get_column('contest') } |
100 | sub rawproblem { shift->get_column('problem') } | |
4ed3f8e7 | 101 | |
de7226ca MG |
102 | after qw/insert update delete/ => sub { |
103 | my ($self) = @_; | |
104 | Gruntmaster::Data::purge '/pb/'; | |
105 | Gruntmaster::Data::purge '/pb/' . $self->rawproblem; | |
106 | }; | |
107 | ||
4ed3f8e7 | 108 | 1; |
4a8747ef MG |
109 | |
110 | __END__ | |
111 | ||
112 | =head1 AUTHOR | |
113 | ||
114 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
115 | ||
116 | =head1 COPYRIGHT AND LICENSE | |
117 | ||
118 | Copyright (C) 2014 by Marius Gavrilescu | |
119 | ||
120 | This library is free software; you can redistribute it and/or modify | |
121 | it under the same terms as Perl itself, either Perl version 5.18.1 or, | |
122 | at your option, any later version of Perl 5 you may have available. | |
123 | ||
124 | ||
125 | =cut |