TT#36007 add relation messages->voip_subscriber

* this relation is to fetch sip data belonging
      to a specific billing.voip_subscriber

Change-Id: Iba8607e88618991ea1ce51d4ccd78567c8648234
changes/05/21505/1
Kirill Solomko 7 years ago
parent f1b0556e92
commit c79529892f

@ -76,6 +76,19 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"voip_subscriber",
"NGCP::Schema::Result::voip_subscribers",
sub {
my $args = shift;
return { -or => [
"$args->{foreign_alias}.uuid" => { -ident => "$args->{self_alias}.caller_uuid" },
"$args->{foreign_alias}.uuid" => { -ident => "$args->{self_alias}.callee_uuid" },
]};
},
{ cascade_copy => 0, cascade_delete => 0, join_type => 'left' }
);
__PACKAGE__->set_primary_key("id");
sub TO_JSON {

Loading…
Cancel
Save