[html-formfu] H:F:M:DBIC condition_from_stash
Gabor HALASZ
halasz.g at freemail.hu
Tue Jan 11 13:21:12 GMT 2011
On 2011.01.11. 13:27, Carl Franks wrote:
> On 11 January 2011 11:47, Gabor HALASZ<halasz.g at freemail.hu> wrote:
>> 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;
>> }
>> }
>>
>>
>
> This looks like the same issue Yuval raised in October.
Sorry, I don't remember.
> I don't think the restriction was originally intended, so I'd accept
> any patch that includes tests that resolves this.
I think, simply on wrong place and checks wrong variable, the correct is:
for my $name ( keys %$from_stash ) {
croak "config value must not be a reference" if ref $name;
my $value = $form->stash->{ $from_stash->{$name} };
$condition->{$name} = $value;
}
becauese the next config:
<condition_from_stash>
<column>
!= hash_key
</column>
</condition_from_stash>
causes a false result in query.
>
> btw, it's now on github, so please branch it and send a pull request when ready.
> https://github.com/fireartist/HTML-FormFu-Model-DBIC
>
I thinking about this, but I have no time on last months.
--
Gabor HALASZ <halasz.g at freemail.hu>
More information about the HTML-FormFu
mailing list