diff Lib/IMPL/Web/View/Metadata/FormMeta.pm @ 368:010ceafd0c5a

form metadata + tests
author cin
date Wed, 04 Dec 2013 17:31:53 +0400
parents 608e74bc309f
children d5c8b955bf8d
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/Metadata/FormMeta.pm	Tue Dec 03 17:55:36 2013 +0400
+++ b/Lib/IMPL/Web/View/Metadata/FormMeta.pm	Wed Dec 04 17:31:53 2013 +0400
@@ -109,12 +109,12 @@
 		my ($model,$type);
 		
 		if ($decl->isMultiple) {
-			$model = \@nodes;
+			$model = \@nodes; 
 			$type = 'ARRAY';
-			$args{holdingType} = $decl->type;
+			$args{holdingType} = $schema->type;
 		} else {
 			$model = shift @nodes;
-			$type = $decl->type;
+			$type = $schema->type;
 		}
 
 		push @props, Meta->new($model,$type,\%args);
@@ -132,7 +132,7 @@
 	my $i = 0;
 	
 	return [
-		map $this->_GetItemMeta($_,$i++), @{$this->model || []}
+		map $this->_GetItemMeta($_,$i++), @{$this->nodes}
 	];
 }
 
@@ -142,22 +142,26 @@
 	die OpException->new("The operation must be performed on the container")
 		unless $this->isMultiple;
 		
-	my $node = $this->model->[$index];
+	my $node = $this->nodes->[$index];
 	
-	return $this->GetItemMeta($node,$index);
+	return $this->_GetItemMeta($node,$index);
 }
 
 sub _GetItemMeta {
 	my ($this,$node,$index) = @_;
 	
+	my @nodes;
+	push @nodes,$node if $node;
+	
 	return Meta->new(
 		$node,
-		$this->decl->type,
+		$this->schema->type,
 		{
 			name => $index,
 			schema => $this->schema,
-			errors => [grep _IsOwnError([$node],$this->decl,$_), @{$this->errors ||[]} ],
-			group => $this
+			errors => [grep _IsErrorRelates([$node],$this->decl,$_), @{$this->errors ||[]} ],
+			group => $this,
+			nodes => \@nodes
 		}
 	);
 }