annotate _test/Test/ORM/Schema.pm @ 28:6d33f75c6e1f

ORM in works
author Sergey
date Mon, 19 Oct 2009 04:13:54 +0400
parents
children dd4d72600c69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
1 package Test::ORM::Schema;
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 require Exporter;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
6 our @ISA = qw(Exporter);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
7 our @EXPORT_OK = qw();
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
8
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
9 package Test::ORM::Schema::Data::User;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
10 use base qw(IMPL::ORM::Object);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
11 use IMPL::Class::Property;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
12
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
13 BEGIN {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
14 public property Name => prop_all, { type => 'String' }; # Field
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
15 public property Id => prop_all, { type => 'String' }; # Field
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
16 public property Roles => prop_all | prop_list, { type=> 'Test::ORM::Schema::Data::Role'}; # HasMany
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
17 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
18
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
19 package Test::ORM::Schema::Data::Role;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
20 use base qw(IMPL::ORM::Object);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
21 use IMPL::Class::Property;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
22
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
23 BEGIN {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
24 public property Name => prop_all, { type => 'String' }; # Field
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
25 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
26
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
27 package Test::ORM::Schema::Data::Session;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
28 use base qw(IMPL::ORM::Object);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
29 use IMPL::Class::Property;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
30 use IMPL::ORM::Helpers qw(Map);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
31
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
32 BEGIN {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
33 public property Id => prop_get, { type => 'String' }; # Field
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
34 public property User => prop_get, { type => 'Test::ORM::Schema::Data::User' }; # HasOne
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
35 public property Data => prop_all, { type => Map( 'String','String' ) }; # HasOne
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
36 public property AccessTime => prop_get { type => 'DateTime' }; # Field
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
37 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
38
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
39 package Test::ORM::Schema::Data;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
40 use base qw(IMPL::ORM::Schema);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
41
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
42 __PACKAGE__->usePrefix(__PACKAGE__);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
43 __PACKAGE__->Classes qw(
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
44 User
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
45 Role
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
46 Session
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
47 );
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
48
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
49 __PACKAGE__->ValueTypes (
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
50 'String' => 'IMPL::ORM::Value::String',
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
51 'DateTime' => 'IMPL::ORM::Value::DateTime',
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
52 'Integer' => 'IMPL::ORM::Value::Inetger',
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
53 'Float' => 'IMPL::ORM::Value::Float',
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
54 'Decimal' => 'IMPL::ORM::Value::Decimal'
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
55 );
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
56
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
57 1;