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

Charlie Garrison garrison at zeta.org.au
Sun Jan 31 09:15:05 GMT 2010


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?

Is the above patch suitable for inclusion in FF::Model::DBIC?

Thanks,
Charlie

-- 
    Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
    〠 PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt



More information about the HTML-FormFu mailing list