annotate Lib/IMPL/ORM/Entity.pm @ 27:b544a772b654

ORM in progress
author Sergey
date Fri, 16 Oct 2009 16:37:53 +0400
parents 03e58a454b20
children 6d33f75c6e1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 package IMPL::ORM::Entity;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3 use warnings;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
4
27
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
5 use base qw(IMPL::Object);
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
27
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
7 use IMPL::Class::Property::Direct;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
8
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
9 BEGIN {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
10 public _direct property Name => prop_get;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
11 public _direct property Class => prop_get;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
12 public _direct property Values => prop_get;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
13 public _direct property Schema => prop_get;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
14 }
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
15
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
16 sub CTOR {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
17 my ($this,$class,$schema) = @_;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
18
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
19
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
20 }
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
21
27
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
22 sub Store;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
23 *Store = \&dbgStore;
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
24
27
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
25 sub dbgStore {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
26 my ($this,$prop,$value) = @_;
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
27
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
28 if ( my $container = $this->{$Values}{$prop} ) {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
29 if ($container->{type} eq 'SCALAR') {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
30
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
31 } else {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
32
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
33 }
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
34
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
35 } else {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
36 die new IMPL::InvalidOperationException("Property not found",$this->Name,$prop);
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
37 }
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
38 }
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
39
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
40 sub Get {
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
41
b544a772b654 ORM in progress
Sergey
parents: 0
diff changeset
42 }
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
43
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
44 1;