Lines 179-185
Generates the DBIC join attribute based on extended_attributes query entries, an
Link Here
|
179 |
&& reftype( $attributes->{prefetch} ) eq 'ARRAY' |
179 |
&& reftype( $attributes->{prefetch} ) eq 'ARRAY' |
180 |
&& grep ( /extended_attributes/, @{ $attributes->{prefetch} } ) ) |
180 |
&& grep ( /extended_attributes/, @{ $attributes->{prefetch} } ) ) |
181 |
{ |
181 |
{ |
182 |
my @array = $self->_get_extended_attributes_entries( $filtered_params, 0 ); |
182 |
my @array = $self->_get_extended_attributes_entries( $filtered_params ); |
183 |
|
183 |
|
184 |
# Calling our private method to build the extended attributes relations |
184 |
# Calling our private method to build the extended attributes relations |
185 |
my @joins = $result_set->_build_extended_attributes_relations(\@array); |
185 |
my @joins = $result_set->_build_extended_attributes_relations(\@array); |
Lines 559-565
Example: Returns 2 if given a $filtered_params containing the below:
Link Here
|
559 |
=cut |
559 |
=cut |
560 |
|
560 |
|
561 |
sub _get_extended_attributes_entries { |
561 |
sub _get_extended_attributes_entries { |
562 |
my ( $self, $params, $extended_attributes_entries, @array ) = @_; |
562 |
my ( $self, $params, @array ) = @_; |
563 |
|
563 |
|
564 |
if ( reftype($params) && reftype($params) eq 'HASH' ) { |
564 |
if ( reftype($params) && reftype($params) eq 'HASH' ) { |
565 |
|
565 |
|
Lines 579-589
sub _get_extended_attributes_entries {
Link Here
|
579 |
if $params->{'extended_attributes.type'}; |
579 |
if $params->{'extended_attributes.type'}; |
580 |
|
580 |
|
581 |
foreach my $key ( keys %{$params} ) { |
581 |
foreach my $key ( keys %{$params} ) { |
582 |
return $self->_get_extended_attributes_entries( $params->{$key}, $extended_attributes_entries, @array ); |
582 |
return $self->_get_extended_attributes_entries( $params->{$key}, @array ); |
583 |
} |
583 |
} |
584 |
} elsif ( reftype($params) && reftype($params) eq 'ARRAY' ) { |
584 |
} elsif ( reftype($params) && reftype($params) eq 'ARRAY' ) { |
585 |
foreach my $ea_instance (@$params) { |
585 |
foreach my $ea_instance (@$params) { |
586 |
@array = $self->_get_extended_attributes_entries( $ea_instance, $extended_attributes_entries, @array ); |
586 |
@array = $self->_get_extended_attributes_entries( $ea_instance, @array ); |
587 |
} |
587 |
} |
588 |
return @array; |
588 |
return @array; |
589 |
} else { |
589 |
} else { |
Lines 628-642
It'll be rewritten as:
Link Here
|
628 |
sub _rewrite_related_metadata_query { |
628 |
sub _rewrite_related_metadata_query { |
629 |
my ( $params, $key, $value, @array ) = @_; |
629 |
my ( $params, $key, $value, @array ) = @_; |
630 |
|
630 |
|
631 |
my $old_key_value = delete $params->{ 'extended_attributes.' . $key }; |
631 |
if(ref \$params->{ 'extended_attributes.' . $key } eq 'SCALAR' ){ |
632 |
my $new_key_value = "extended_attributes_$old_key_value" . "." . $key; |
632 |
my $old_key_value = delete $params->{ 'extended_attributes.' . $key }; |
633 |
$params->{$new_key_value} = $old_key_value; |
633 |
my $new_key_value = "extended_attributes_$old_key_value" . "." . $key; |
|
|
634 |
$params->{$new_key_value} = $old_key_value; |
634 |
|
635 |
|
635 |
my $old_value_value = delete $params->{ 'extended_attributes.' . $value }; |
636 |
my $old_value_value = delete $params->{ 'extended_attributes.' . $value }; |
636 |
my $new_value_value = "extended_attributes_$old_key_value" . "." . $value; |
637 |
my $new_value_value = "extended_attributes_$old_key_value" . "." . $value; |
637 |
$params->{$new_value_value} = $old_value_value; |
638 |
$params->{$new_value_value} = $old_value_value; |
638 |
|
639 |
push @array, $old_key_value; |
639 |
push @array, $old_key_value; |
640 |
} |
640 |
|
641 |
|
641 |
return @array; |
642 |
return @array; |
642 |
} |
643 |
} |
643 |
- |
|
|