[html-formfu] Assigning array value to column using FF::Model::DBIC

Carl Franks fireartist at gmail.com
Sun Jan 31 20:31:21 GMT 2010


On 31 January 2010 09:15, Charlie Garrison <garrison at zeta.org.au> wrote:
> Good evening,
>
> I have a column configured with `inflate_column` to allow me to work with an
> array (based on string from join/split). I want to pass multi-value form
> fields as an array (inflated value) to the column.
>
> Looking at `_save_columns` in FF::Model::DBIC I can see that the following
> is used to get the form param value:
>
>    my $value = $form->param_value( $field->nested_name );
>
> I need to get the param value as an array:
>
>    my $value = $form->param_array( $field->nested_name );
>
> I patched FF::Model::DBIC like:
>
>    my $value = ( $dbic->result_source->has_column($accessor)
>              and exists
> $dbic->result_source->column_info($accessor)->{is_array} )
>        ? $form->param_array( $field->nested_name )
>        : $form->param_value( $field->nested_name ) ;
>
> And I added "is_array => 1" to my column definition.
>
> Is that a reasonable solution? Is there some other way I should approach
> this?

Hi,

A search of the DBIx::Class distribution doesn't turn up any hits for
"is_array" - is this a standard that anyone else uses?
If not, does DBIC already use something else for the same meaning?

Cheers,
Carl



More information about the HTML-FormFu mailing list