From 6a720b0a46989ea98e556e935817a33d9ea56914 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 31 Aug 2017 12:17:05 +0100 Subject: [PATCH] Added Entity to customer --- lib/Pear/LocalLoop/Schema/Result/Customer.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Pear/LocalLoop/Schema/Result/Customer.pm b/lib/Pear/LocalLoop/Schema/Result/Customer.pm index 4ce92e2..147f945 100644 --- a/lib/Pear/LocalLoop/Schema/Result/Customer.pm +++ b/lib/Pear/LocalLoop/Schema/Result/Customer.pm @@ -13,6 +13,11 @@ __PACKAGE__->add_columns( is_auto_increment => 1, is_nullable => 0, }, + "entity_id" => { + data_type => "integer", + is_nullable => 0, + is_foreign_key => 1, + }, "display_name" => { data_type => "varchar", size => 255, @@ -36,11 +41,10 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -__PACKAGE__->might_have( - "user", - "Pear::LocalLoop::Schema::Result::User", - { "foreign.customer_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, +__PACKAGE__->belongs_to( + "entity", + "Pear::LocalLoop::Schema::Result::Entity", + "entity_id", ); 1;