Mercurial > pub > Impl
view Lib/IMPL/SQL/Schema/Constraint/PrimaryKey.pm @ 197:6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
IMPL::Transform now admires object inheritance while searching for the transformation
Added HTTP some exceptions
IMPL::Web::Application::RestResource almost implemented
author | sergey |
---|---|
date | Thu, 19 Apr 2012 02:10:02 +0400 |
parents | 6148f89bb7bf |
children | 4ddb27ff4a0b |
line wrap: on
line source
package IMPL::SQL::Schema::Constraint::PrimaryKey; use strict; use parent qw(IMPL::SQL::Schema::Constraint::Index); use IMPL::Class::Property; use IMPL::Class::Property::Direct; __PACKAGE__->PassThroughArgs; __PACKAGE__->RegisterAlias('pk'); BEGIN { public _direct property connectedFK => prop_get; } sub CTOR { my ($this,%args) = @_; $this->{$connectedFK} = {}; } sub ConnectFK { my ($this,$FK) = @_; UNIVERSAL::isa($FK,'IMPL::SQL::Schema::Constraint::ForeignKey') or die new Exception('Aprimary key could be connected only to a foreign key'); not exists $this->{$connectedFK}->{$FK->uniqName} or die new Exception('This primary key already conneted with the specified foreing key',$FK->name,$FK->table->name); $this->{$connectedFK}->{$FK->uniqName} = $FK; } sub DisconnectFK { my ($this,$FK) = @_; delete $this->{$connectedFK}->{$FK->uniqName}; } sub Dispose { my ($this) = @_; delete $this->{$connectedFK}; $this->SUPER::Dispose; } 1;