annotate Lib/IMPL/ORM/Schema/Field.pm @ 38:d660fb38b7cc

small fixes ORM shema to SQL schema transformation
author Sergey
date Mon, 23 Nov 2009 17:57:07 +0300
parents 6d33f75c6e1f
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
1 package IMPL::ORM::Schema::Field;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
2 use strict;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
3 use warnings;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
4
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
5 use base qw(IMPL::DOM::Node);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
7
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
8 BEGIN {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
9 public property fieldName => prop_get | owner_set;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
10 public property fieldType => prop_get | owner_set;
38
d660fb38b7cc small fixes
Sergey
parents: 28
diff changeset
11 public property fieldNullbale => prop_get | owner_set;
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
12 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
13
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
14 our %CTOR = (
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
15 'IMPL::DOM::Node' => sub { nodeName => 'Field' }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
16 );
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
17
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
18 sub CTOR {
38
d660fb38b7cc small fixes
Sergey
parents: 28
diff changeset
19 my ($this,$name,$type,$nullable) = @_;
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
20
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
21 $this->fieldName($name) or die new IMPL::InvalidArgumentException('A name is required for the field');
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
22 $this->fieldType($type) or die new IMPL::InvalidArgumentException('A type is required for the field');
38
d660fb38b7cc small fixes
Sergey
parents: 28
diff changeset
23 $this->fieldNullbale(1) if $nullable;
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
24 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
25
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
26 sub canHaveChildren {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
27 0;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
28 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
29
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
30 1;