DBIx-Class-Result-ProxyField
view release on metacpan or search on metacpan
lib/DBIx/Class/Result/ProxyField.pm view on Meta::CPAN
Class function
format hash columns data of object with public accessor
=cut
sub class_adaptator_to_bdd
{
my ($class, $attributes) = @_;
if (ref $attributes eq 'HASH')
{
foreach my $key_ext (keys %{$rh_ext_to_bdd->{$class}})
{
my $key_bdd = $rh_ext_to_bdd->{$class}->{$key_ext};
if (exists $attributes->{$key_ext})
{
$attributes->{$key_bdd} = $attributes->{$key_ext};
delete $attributes->{$key_ext};
}
# $key = champ bdd
}
}
return $attributes;
}
=head2 columns_data
Instance function
re defined columns_data function to component Result::DataColumns
return only column data Hash with public name
=cut
sub columns_data
{
my $self = shift;
my $class = ref $self;
my $rh_data = $self->next::method(@_);
foreach my $key_bdd (keys %{$rh_bdd_to_ext->{$class}})
{
my $key_ext = $rh_bdd_to_ext->{$class}->{$key_bdd};
my $value = $self->$key_bdd;
$value = $value->ymd.' '.$value->hms if (ref $value eq 'DateTime');
$rh_data->{$key_ext} = $value;
delete $rh_data->{$key_bdd};
}
return $rh_data;
}
=head2 update
Instance function
re defined update to adapt object field before update
=cut
sub update
{
my $self = shift;
my $rh_attrs = $_[0];
if (defined $rh_attrs)
{
my $class = ref $self;
$class->class_adaptator_to_bdd($rh_attrs);
}
return $self->next::method($rh_attrs);
}
=head2 insert
Instance function
re defined insert to adapt object field before insert
=cut
sub insert
{
my $self = shift;
return $self->next::method(@_);
}
=head2 delete
Instance function
re defined delete to adapt object field before delete
=cut
sub delete
{
my $self = shift;
return $self->next::method(@_);
}
=head1 AUTHOR
Nicolas Oudard, C<nicolas@oudard.org>
=head1 BUGS
Please report any bugs or feature requests to C<bug-dbix-class-result-proxyfield at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-Result-ProxyField>. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc DBIx::Class::Result::ProxyField
=over 4
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-Result-ProxyField>
( run in 0.614 second using v1.01-cache-2.11-cpan-5511b514fd6 )