Mercurial > pub > Impl
diff Lib/IMPL/ORM/Entity.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | 6d33f75c6e1f |
children | 4267a2ac3d46 |
line wrap: on
line diff
--- a/Lib/IMPL/ORM/Entity.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/IMPL/ORM/Entity.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,48 +1,48 @@ -package IMPL::ORM::Entity; -use strict; -use warnings; - -use base qw(IMPL::Object); -use IMPL::Class::Property; -use IMPL::Class::Property::Direct; - -BEGIN { - public _direct property Name => prop_get; - public _direct property Class => prop_get; - public _direct property Values => prop_get; - public _direct property Schema => prop_get; -} - -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; -*Store = \&dbgStore; - -sub dbgStore { - my ($this,$prop,$value) = @_; - - if ( my $container = $this->{$Values}{$prop} ) { - $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; +package IMPL::ORM::Entity; +use strict; +use warnings; + +use base qw(IMPL::Object); +use IMPL::Class::Property; +use IMPL::Class::Property::Direct; + +BEGIN { + public _direct property Name => prop_get; + public _direct property Class => prop_get; + public _direct property Values => prop_get; + public _direct property Schema => prop_get; +} + +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; +*Store = \&dbgStore; + +sub dbgStore { + my ($this,$prop,$value) = @_; + + if ( my $container = $this->{$Values}{$prop} ) { + $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;