Re: Trigger select does not trigger on TEMP fields
[prev]
[thread]
[next]
[Date index for 2004/06/25]
--On Friday, June 25, 2004 4:30 PM -0400 William McKee
<william@xxxxxxx.xxx> wrote:
>
> package QT::Orders;
[...]
> __PACKAGE__->has_a(user_id => 'QT::DBI::Users');
>
> package QT::DBI::Users;
[...]
> __PACKAGE__->columns(TEMP => qw/full_email/);
[...]
> Using the above, I search orders via the following code:
>
> my $order = QT::Orders->search(id => 1)->first;
>
>
> If I call $order->user_id->full_email, I get an empty string. However,
> if I first call $order->user_id->type_id (or any other *real* field)
> then call $order->user_id->full_email, I get the expected value.
I think the patch below will fix the problem. It changes the behavior of
_flesh() a bit, but _flesh() isn't called from anywhere but get(), so it's
a wash internally. It is used in the test suite, but I don't know whether
that constitutes endoresment of its public use.
--
Regards,
Charles Bailey < bailey _at_ newman _dot_ upenn _dot_ edu >
Newman Center at the University of Pennsylvania
--- lib/Class/DBI.pm~ Fri Apr 30 12:08:19 2004
+++ lib/Class/DBI.pm Fri Jun 25 18:24:36 2004
@@ -842,6 +842,7 @@
if (my @fetch_cols = grep !$self->_attribute_exists($_), @cols) {
$self->_flesh($self->__grouper->groups_for(@fetch_cols));
+ $self->call_trigger('select');
}
return $self->_attrs(@cols);
@@ -855,7 +856,6 @@
my %row;
@row{@want} = $self->sql_Flesh(join ", ",
@want)->select_row($self->id);
$self->_attribute_store(\%row);
- $self->call_trigger('select');
}
return 1;
}
|
|
Re: Trigger select does not trigger on TEMP fields
Charles Bailey 22:31 on 25 Jun 2004
|