[html-formfu] H:F:M:DBIC condition_from_stash
Gabor HALASZ
halasz.g at freemail.hu
Tue Jan 11 11:47:31 GMT 2011
Hi Carl!
Why not accepts hashes from stash in condition_from_stash? I read the
DBIC.pm:
if ( defined( my $from_stash = $attrs->{condition_from_stash} ) ) {
$condition = $condition ? { %{$condition} } : {}; # avoid
overwriting attrs->{condition}
for my $name ( keys %$from_stash ) {
my $value = $form->stash->{ $from_stash->{$name} };
croak "input value must not be a reference"
if ref $value;
$condition->{$name} = $value;
}
}
and If I unterstod the dump of form object well, this limitation isn't
neccessary, but makes hard to create a flexibile conditions. I created
various configs like this:
<condition>
<id>
> 1
</id>
</condition>
<condition_from_stash>
name user
</condition_from_stash>
placed the condition to the form's stash (tried in Catalyst environment):
$form->stash->{user} = { '!=' => $c->stash->{userRS}->name };
commented out the croak line above, and I got the correct query:
WHERE ( ( id > ? AND name != ? ) ): '1', 'Administrator'
What's your opinion?
Thanks
--
Gabor HALASZ <halasz.g at freemail.hu>
More information about the HTML-FormFu
mailing list