line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::MuForm::Field::PrimaryKey; |
2
|
|
|
|
|
|
|
# ABSTRACT: primary key field |
3
|
|
|
|
|
|
|
|
4
|
21
|
|
|
21
|
|
1368
|
use Moo; |
|
21
|
|
|
|
|
25
|
|
|
21
|
|
|
|
|
142
|
|
5
|
|
|
|
|
|
|
extends 'Data::MuForm::Field'; |
6
|
21
|
|
|
21
|
|
4454
|
use Types::Standard -types; |
|
21
|
|
|
|
|
26
|
|
|
21
|
|
|
|
|
164
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'is_primary_key' => ( isa => Bool, is => 'ro', default => '1' ); |
10
|
|
|
|
|
|
|
has '+no_value_if_empty' => ( default => 1 ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BUILD { |
13
|
14
|
|
|
14
|
0
|
325
|
my $self = shift; |
14
|
14
|
50
|
|
|
|
76
|
if ( $self->has_parent ) { |
15
|
14
|
50
|
|
|
|
186
|
if ( $self->parent->has_primary_key ) { |
16
|
0
|
|
|
|
|
0
|
push @{ $self->parent->primary_key }, $self; |
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else { |
19
|
14
|
|
|
|
|
266
|
$self->parent->primary_key( [ $self ] ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Data::MuForm::Field::PrimaryKey - primary key field |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
version 0.04 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This field is for providing the primary key for Repeatable fields: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has_field 'addresses' => ( type => 'Repeatable' ); |
45
|
|
|
|
|
|
|
has_field 'addresses.address_id' => ( type => 'PrimaryKey' ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Do not use this field to hold the primary key of the form's main db object (model). |
48
|
|
|
|
|
|
|
That primary key is in the 'model_id' attribute. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Gerda Shank |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Gerda Shank. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
59
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |