comparison _test/Test/ORM/Schema.pm @ 165:76515373dac0

Added Class::Template, Rewritten SQL::Schema 'use parent' directive instead of 'use base'
author wizard
date Sat, 23 Apr 2011 23:06:48 +0400
parents 16ada169ca75
children
comparison
equal deleted inserted replaced
164:eb3e9861a761 165:76515373dac0
1 package Test::ORM::Schema; 1 package Test::ORM::Schema;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 use base qw(IMPL::Test::Unit); 4 use parent qw(IMPL::Test::Unit);
5 5
6 require IMPL::SQL::Schema::Traits::mysql; 6 require IMPL::SQL::Schema::Traits::mysql;
7 7
8 __PACKAGE__->PassThroughArgs; 8 __PACKAGE__->PassThroughArgs;
9 9
47 $sqlSchema->Dispose; 47 $sqlSchema->Dispose;
48 }; 48 };
49 49
50 50
51 package Test::ORM::Schema::Data::User; 51 package Test::ORM::Schema::Data::User;
52 use base qw(IMPL::ORM::Object); 52 use parent qw(IMPL::ORM::Object);
53 use IMPL::Class::Property; 53 use IMPL::Class::Property;
54 54
55 BEGIN { 55 BEGIN {
56 public property Name => prop_all, { type => 'String' }; # Field 56 public property Name => prop_all, { type => 'String' }; # Field
57 public property Id => prop_all, { type => 'String' }; # Field 57 public property Id => prop_all, { type => 'String' }; # Field
58 public property Roles => prop_all | prop_list, { type=> 'Test::ORM::Schema::Data::Role'}; # HasMany 58 public property Roles => prop_all | prop_list, { type=> 'Test::ORM::Schema::Data::Role'}; # HasMany
59 } 59 }
60 60
61 package Test::ORM::Schema::Data::Role; 61 package Test::ORM::Schema::Data::Role;
62 use base qw(IMPL::ORM::Object); 62 use parent qw(IMPL::ORM::Object);
63 use IMPL::Class::Property; 63 use IMPL::Class::Property;
64 64
65 BEGIN { 65 BEGIN {
66 public property Name => prop_all, { type => 'String' }; # Field 66 public property Name => prop_all, { type => 'String' }; # Field
67 } 67 }
68 68
69 package Test::ORM::Schema::Data::Session; 69 package Test::ORM::Schema::Data::Session;
70 use base qw(IMPL::ORM::Object); 70 use parent qw(IMPL::ORM::Object);
71 use IMPL::Class::Property; 71 use IMPL::Class::Property;
72 use IMPL::ORM::Helpers qw(Map); 72 use IMPL::ORM::Helpers qw(Map);
73 73
74 BEGIN { 74 BEGIN {
75 public property Id => prop_get, { type => 'String' }; # Field 75 public property Id => prop_get, { type => 'String' }; # Field
77 #public property Data => prop_all, { type => Map( 'String','String' ) }; # HasOne 77 #public property Data => prop_all, { type => Map( 'String','String' ) }; # HasOne
78 public property AccessTime => prop_get, { type => 'DateTime' }; # Field 78 public property AccessTime => prop_get, { type => 'DateTime' }; # Field
79 } 79 }
80 80
81 package Test::ORM::Schema::Data; 81 package Test::ORM::Schema::Data;
82 use base qw(IMPL::ORM::Schema); 82 use parent qw(IMPL::ORM::Schema);
83 83
84 __PACKAGE__->ValueTypes ( 84 __PACKAGE__->ValueTypes (
85 String => 'IMPL::ORM::Value::String', 85 String => 'IMPL::ORM::Value::String',
86 DateTime => 'IMPL::ORM::Value::DateTime', 86 DateTime => 'IMPL::ORM::Value::DateTime',
87 Integer => 'IMPL::ORM::Value::Inetger', 87 Integer => 'IMPL::ORM::Value::Inetger',