diff Lib/IMPL/Web/View/Metadata/ObjectMeta.pm @ 370:cbf4febf0930

ObjectMeta, Tests, migrating to the new metadata model.
author sergey
date Tue, 10 Dec 2013 03:02:01 +0400
parents 7c784144d2f1
children d5c8b955bf8d
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/Metadata/ObjectMeta.pm	Mon Dec 09 17:35:34 2013 +0400
+++ b/Lib/IMPL/Web/View/Metadata/ObjectMeta.pm	Tue Dec 10 03:02:01 2013 +0400
@@ -1,6 +1,7 @@
-package IMPL::Web::View::Metadata::FormMeta;
+package IMPL::Web::View::Metadata::ObjectMeta;
 use strict;
 
+use IMPL::lang;
 use IMPL::Const qw(:prop);
 use IMPL::declare {
 	require => {
@@ -11,7 +12,11 @@
 		AbstractObject => '-IMPL::Object::Abstract'
 	},
 	base => [
-		'IMPL::Web::View::Metadata::BaseMeta' => '@_'
+		'IMPL::Web::View::Metadata::BaseMeta' => sub {
+			my ($model,$type,$args) = @_;
+			$type ||= typeof($model);
+			return ($model,$type,$args);
+		}
 	],
 	props => [
 		isMultiple => PROP_RO,
@@ -26,8 +31,9 @@
 sub CTOR {
 	my ($this,$model,$type,$args) = @_;
 	
-	$type ||= typeof($model);
-	$args->{isMultiple} ||= $type eq 'ARRAY';
+	$type = $this->modelType;
+	
+	$args->{isMultiple} ||= $type && $type eq 'ARRAY';
 	
 	if ($args) {
 		$this->$_($args->{$_}) foreach grep $args->{$_}, qw(isMultiple holdingType);
@@ -58,7 +64,7 @@
 			
 			push @props, Meta->new($pv, $pt, \%args);
 		}
-	} elsif ( $modelType eq 'HASH' ) {
+	} elsif ( $modelType && $modelType eq 'HASH' ) {
 		while ( my ($k,$v) = each %{$this->model || {}} ) {
 			push @props, Meta->new($v,undef,{name => $k});
 		}