annotate lib/IMPL/ORM/Schema/Field.pm @ 422:b0481c071bea ref20150831

IMPL::Config::Container tests, YAMLConfiguration now works and tested
author cin
date Sun, 20 Aug 2017 00:20:41 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::ORM::Schema::Field;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use warnings;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 use parent qw(IMPL::DOM::Node);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 use IMPL::Class::Property;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 BEGIN {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 public property fieldName => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 public property fieldType => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 public property fieldNullbale => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 our %CTOR = (
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 'IMPL::DOM::Node' => sub { nodeName => 'Field' }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 sub CTOR {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 my ($this,$name,$type,$nullable) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 $this->fieldName($name) or die new IMPL::InvalidArgumentException('A name is required for the field');
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 $this->fieldType($type) or die new IMPL::InvalidArgumentException('A type is required for the field');
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 $this->fieldNullbale(1) if $nullable;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 sub canHaveChildren {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 0;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 1;