comparison lib/IMPL/SQL/Schema/Constraint.pm @ 417:3ed0c58e9da3 ref20150831

working on di container, tests
author cin
date Mon, 02 Nov 2015 01:56:53 +0300
parents c6e90e02dd17
children
comparison
equal deleted inserted replaced
416:cc2cf8c0edc2 417:3ed0c58e9da3
18 18
19 my %aliases; 19 my %aliases;
20 20
21 sub CTOR { 21 sub CTOR {
22 my ($this,%args) = @_; 22 my ($this,%args) = @_;
23 is( $args{table}, typeof IMPL::SQL::Schema::Table ) or 23 is( $args{table}, 'IMPL::SQL::Schema::Table' ) or
24 die new IMPL::InvalidArgumentException("table argument must be a table object"); 24 die new IMPL::InvalidArgumentException("table argument must be a table object");
25 $this->{$name} = $args{'name'}; 25 $this->{$name} = $args{'name'};
26 $this->{$table} = $args{'table'}; 26 $this->{$table} = $args{'table'};
27 $this->columns( [map { ResolveColumn($this->table,$_) } @{$args{'columns'}}] ); 27 $this->columns( [map { ResolveColumn($this->table,$_) } @{$args{'columns'}}] );
28 } 28 }
73 } 73 }
74 74
75 sub ResolveAlias { 75 sub ResolveAlias {
76 my ($self,$alias) = @_; 76 my ($self,$alias) = @_;
77 77
78 return isclass($alias, typeof IMPL::SQL::Schema::Constraint) ? $alias : $aliases{$alias}; 78 return isclass($alias, 'IMPL::SQL::Schema::Constraint') ? $alias : $aliases{$alias};
79 } 79 }
80 80
81 sub RegisterAlias { 81 sub RegisterAlias {
82 my ($self,$alias) = @_; 82 my ($self,$alias) = @_;
83 83
84 $aliases{$alias} = typeof($self); 84 $aliases{$alias} = ref $self ? typeof($self) : $self;
85 } 85 }
86 86
87 1; 87 1;