diff Lib/IMPL/ORM/Object.pm @ 30:dd4d72600c69

ORM in works
author Sergey
date Tue, 03 Nov 2009 16:31:47 +0300
parents 37160f7c8edb
children d59526f6310e
line wrap: on
line diff
--- a/Lib/IMPL/ORM/Object.pm	Wed Oct 21 17:30:20 2009 +0400
+++ b/Lib/IMPL/ORM/Object.pm	Tue Nov 03 16:31:47 2009 +0300
@@ -42,9 +42,9 @@
     return $this->{$_entities}{$class} ? $this->{$_entities}{$class}->Get($prop,$value) : undef;
 }
 
-#sub _PropertyImplementor {
-#    'IMPL::ORM::Property'
-#}
+sub _PropertyImplementor {
+    'IMPL::ORM::PropertyImplementor'
+}
 
 sub entityName {
     (my $self = ref $_[0] || $_[0]) =~ s/::/_/g;
@@ -52,16 +52,16 @@
 }
 
 sub ormGetSchema {
-    my ($self,$dataSchema) = @_;
+    my ($self,$dataSchema,$surrogate) = @_;
     
-    my $schema = IMPL::ORM::Schema::Entity->new($self->entityName);
+    my $schema = $surrogate || IMPL::ORM::Schema::Entity->new($self->entityName);
     
     # для текущего класса, проходим по всем свойствам
     foreach my $ormProp (
         $self->get_meta(
             'IMPL::Class::PropertyInfo',
             sub {
-                UNIVERSAL::isa($_->Implementor, 'IMPL::ORM::Property' )
+                UNIVERSAL::isa($_->Implementor, 'IMPL::ORM::PropertyImplementor' )
             },
             0
         )
@@ -92,7 +92,7 @@
         # по всем классам
         foreach my $super (grep $_->isa(__PACKAGE__), @{"${class}::ISA"}) {
             my $type = $dataSchema->resolveType($super) or die new IMPL::InvalidOperationException("Failed to resolve a super class due building schema for a class", $class, $super);
-            $schema->appentChild(new IMPL::ORM::Schema::Relation::Subclass($type));
+            $schema->appendChild(new IMPL::ORM::Schema::Relation::Subclass($type));
         }
     }