DB/Schema/Result/Item.pm

filter: Statementstmt 93.4% 43 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 4 totaltotal 86.2% 50 / 58 CC 1 SCAR 1.2
CC
1
Cov
93%
tag_names
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« DB/Schema.pm ↑ Summary DB/Schema/ResultSet/ItemData.pm »
1 13 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Biblio::Zotero::DB::Schema::Result::Item;
3 13 $Biblio::Zotero::DB::Schema::Result::Item::VERSION = '0.004';
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6  
7  
8 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 ▶use base 'DBIx::Class::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 13 __PACKAGE__->table("items");
15  
16  
17 13 __PACKAGE__->add_columns(
18 "itemid",
19 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
20 "itemtypeid",
21 { data_type => "int", is_nullable => 0 },
22 "dateadded",
23 {
24 data_type => "timestamp",
25 default_value => \"current_timestamp",
26 is_nullable => 0,
27 },
28 "datemodified",
29 {
30 data_type => "timestamp",
31 default_value => \"current_timestamp",
32 is_nullable => 0,
33 },
34 "clientdatemodified",
35 {
36 data_type => "timestamp",
37 default_value => \"current_timestamp",
38 is_nullable => 0,
39 },
40 "libraryid",
41 { data_type => "int", is_foreign_key => 1, is_nullable => 1 },
42 "key",
43 { data_type => "text", is_nullable => 0 },
44 );
45  
46  
47 13 __PACKAGE__->set_primary_key("itemid");
48  
49  
50 13 __PACKAGE__->add_unique_constraint("libraryid_key_unique", ["libraryid", "key"]);
51  
52  
53 13 __PACKAGE__->has_many(
54 "collection_items",
55 "Biblio::Zotero::DB::Schema::Result::CollectionItem",
56 { "foreign.itemid" => "self.itemid" },
57 { cascade_copy => 0, cascade_delete => 0 },
58 );
59  
60  
61 13 __PACKAGE__->might_have(
62 "fulltext_item",
63 "Biblio::Zotero::DB::Schema::Result::FulltextItem",
64 { "foreign.itemid" => "self.itemid" },
65 { cascade_copy => 0, cascade_delete => 0 },
66 );
67  
68  
69 13 __PACKAGE__->has_many(
70 "fulltext_item_words",
71 "Biblio::Zotero::DB::Schema::Result::FulltextItemWord",
72 { "foreign.itemid" => "self.itemid" },
73 { cascade_copy => 0, cascade_delete => 0 },
74 );
75  
76  
77 13 __PACKAGE__->might_have(
78 "item_attachments_itemid",
79 "Biblio::Zotero::DB::Schema::Result::ItemAttachment",
80 { "foreign.itemid" => "self.itemid" },
81 { cascade_copy => 0, cascade_delete => 0 },
82 );
83  
84  
85 13 __PACKAGE__->has_many(
86 "item_attachments_sourceitemids",
87 "Biblio::Zotero::DB::Schema::Result::ItemAttachment",
88 { "foreign.sourceitemid" => "self.itemid" },
89 { cascade_copy => 0, cascade_delete => 0 },
90 );
91  
92  
93 13 __PACKAGE__->has_many(
94 "item_creators",
95 "Biblio::Zotero::DB::Schema::Result::ItemCreator",
96 { "foreign.itemid" => "self.itemid" },
97 { cascade_copy => 0, cascade_delete => 0 },
98 );
99  
100  
101 13 __PACKAGE__->has_many(
102 "item_datas",
103 "Biblio::Zotero::DB::Schema::Result::ItemData",
104 { "foreign.itemid" => "self.itemid" },
105 { cascade_copy => 0, cascade_delete => 0 },
106 );
107  
108  
109 13 __PACKAGE__->might_have(
110 "item_notes_itemid",
111 "Biblio::Zotero::DB::Schema::Result::ItemNote",
112 { "foreign.itemid" => "self.itemid" },
113 { cascade_copy => 0, cascade_delete => 0 },
114 );
115  
116  
117 13 __PACKAGE__->has_many(
118 "item_notes_sourceitemids",
119 "Biblio::Zotero::DB::Schema::Result::ItemNote",
120 { "foreign.sourceitemid" => "self.itemid" },
121 { cascade_copy => 0, cascade_delete => 0 },
122 );
123  
124  
125 13 __PACKAGE__->has_many(
126 "item_see_also_itemids",
127 "Biblio::Zotero::DB::Schema::Result::ItemSeeAlso",
128 { "foreign.itemid" => "self.itemid" },
129 { cascade_copy => 0, cascade_delete => 0 },
130 );
131  
132  
133 13 __PACKAGE__->has_many(
134 "item_see_also_linkeditemids",
135 "Biblio::Zotero::DB::Schema::Result::ItemSeeAlso",
136 { "foreign.linkeditemid" => "self.itemid" },
137 { cascade_copy => 0, cascade_delete => 0 },
138 );
139  
140  
141 13 __PACKAGE__->has_many(
142 "item_tags",
143 "Biblio::Zotero::DB::Schema::Result::ItemTag",
144 { "foreign.itemid" => "self.itemid" },
145 { cascade_copy => 0, cascade_delete => 0 },
146 );
147  
148  
149 13 __PACKAGE__->belongs_to(
150 "libraryid",
151 "Biblio::Zotero::DB::Schema::Result::Library",
152 { libraryid => "libraryid" },
153 {
154 is_deferrable => 0,
155 join_type => "LEFT",
156 on_delete => "NO ACTION",
157 on_update => "NO ACTION",
158 },
159 );
160  
161  
162 13 __PACKAGE__->many_to_many("itemids", "item_see_also_linkeditemids", "itemid");
163  
164  
165 13 __PACKAGE__->many_to_many("linkeditemids", "item_see_also_linkeditemids", "linkeditemid");
166  
167  
168 13 __PACKAGE__->many_to_many("tagids", "item_tags", "tagid");
169  
170  
171 13 __PACKAGE__->many_to_many("wordids", "fulltext_item_words", "wordid");
172  
173  
174 # Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-07-02 23:02:38
175 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OcWFl3GnRhMxSUTwxOnJCw
176  
177 # NOTE: extended DBIC schema below
178  
179 7 ▶sub is_attachment {
Subroutine is_attachment: called CC=1 SCAR=0.0
Pod undocumented
180 7 my $self = shift;
181 7 !! defined $self->item_attachments_itemid;
182 }
183  
184 7 ▶sub is_source_item {
Subroutine is_source_item: called CC=1 SCAR=0.0
Pod undocumented
185 7 my $self = shift;
186 7 !! $self->item_attachments_sourceitemids->count;
187 }
188  
189 # TODO: document
190 0 ▶sub tag_names {
Subroutine tag_names: not called CC=1 SCAR=6.9
Pod undocumented
191 0 my ($self) = @_;
192 0 [map { $_->name } $self->tagids];
193 }
194  
195 # TODO: document
196 20 ▶sub fields {
Subroutine fields: called CC=1 SCAR=0.0
Pod undocumented
197 20 my ($self) = @_;
198 20 $self->item_datas_rs->fields_for_itemid($self->itemid);
199 }
200  
201  
202 13 __PACKAGE__->has_many(
203 "stored_item_attachments_sourceitemids",
204 "Biblio::Zotero::DB::Schema::Result::StoredItemAttachment",
205 { "foreign.sourceitemid" => "self.itemid" },
206 { cascade_copy => 0, cascade_delete => 0 },
207 );
208  
209  
210 13 __PACKAGE__->has_many(
211 "trash_item_attachments_sourceitemids",
212 "Biblio::Zotero::DB::Schema::Result::TrashItemAttachment",
213 { "foreign.sourceitemid" => "self.itemid" },
214 { cascade_copy => 0, cascade_delete => 0 },
215 );
216  
217 13 1;
218  
219 __END__
« DB/Schema.pm ↑ Summary DB/Schema/ResultSet/ItemData.pm »