Mercurial > pub > Impl
diff Lib/IMPL/ORM/Entity.pm @ 28:6d33f75c6e1f
ORM in works
author | Sergey |
---|---|
date | Mon, 19 Oct 2009 04:13:54 +0400 |
parents | b544a772b654 |
children | 16ada169ca75 |
line wrap: on
line diff
--- a/Lib/IMPL/ORM/Entity.pm Fri Oct 16 16:37:53 2009 +0400 +++ b/Lib/IMPL/ORM/Entity.pm Mon Oct 19 04:13:54 2009 +0400 @@ -16,7 +16,13 @@ sub CTOR { my ($this,$class,$schema) = @_; - + $this->{$Class} = $class; + (my $name = $class) =~ s/::/_/g; + $this->{$Name} = $name; + $this->Schema = $schema; + $this->{$Values} = { + map {$_->{name},{type => $_->{type}, virtual => $_->{virtual}}} @$schema + }; } sub Store; @@ -26,19 +32,17 @@ my ($this,$prop,$value) = @_; if ( my $container = $this->{$Values}{$prop} ) { - if ($container->{type} eq 'SCALAR') { - - } else { - - } - + $container->{oldValue} = $container->{value}; + $container->{value} = $value; } else { die new IMPL::InvalidOperationException("Property not found",$this->Name,$prop); } } sub Get { + my ($this,$prop) = @_; + return $this->{$Values}{$prop}{value}; } 1;