| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema::ResultSet::Navigation; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Interchange6::Schema::ResultSet::Navigation | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | Provides extra accessor methods for L<Interchange6::Schema::Result::Navigation> | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 2 | ▶ | use mro 'c3'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 2 | ▶ | use parent 'Interchange6::Schema::ResultSet'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | =head1 METHODS | ||
| 24 | |||
| 25 | =head2 active | ||
| 26 | |||
| 27 | Returns all rows where L<Interchange6::Schema::Result::Navigation/active> is | ||
| 28 | true. | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | sub active { | ||
| 33 | 0 | ▶ | return $_[0]->search( { $_[0]->me('active') => 1 } ); |
|
Subroutine
active: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | } | ||
| 35 | |||
| 36 | =head2 with_active_child_count | ||
| 37 | |||
| 38 | Create slot C<active_child_count> in the resultset containing the count of | ||
| 39 | active child navs. | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | sub with_active_child_count { | ||
| 44 | 0 | ▶ | my $self = shift; |
|
Subroutine
with_active_child_count: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 45 | |||
| 46 | 0 | return $self->search( | |
| 47 | undef, | ||
| 48 | { | ||
| 49 | '+columns' => { | ||
| 50 | active_child_count => | ||
| 51 | $self->correlate('active_children')->count_rs->as_query | ||
| 52 | }, | ||
| 53 | } | ||
| 54 | ); | ||
| 55 | } | ||
| 56 | |||
| 57 | =head2 with_active_product_count | ||
| 58 | |||
| 59 | Create slot C<active_product_count> in the resultset containing the count of | ||
| 60 | active products associated with each navigation row. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | sub with_active_product_count { | ||
| 65 | 0 | ▶ | my $self = shift; |
|
Subroutine
with_active_product_count: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 66 | |||
| 67 | 0 | return $self->search( | |
| 68 | undef, | ||
| 69 | { | ||
| 70 | '+columns' => { | ||
| 71 | active_product_count => | ||
| 72 | $self->correlate('navigation_products') | ||
| 73 | ->related_resultset('product')->active->count_rs->as_query | ||
| 74 | }, | ||
| 75 | } | ||
| 76 | ); | ||
| 77 | } | ||
| 78 | |||
| 79 | 2 | 1; | |