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

Charlie Garrison garrison at zeta.org.au
Mon Feb 1 03:23:49 GMT 2010


Good afternoon,

On 31/01/10 at 8:31 PM -0000, Carl Franks <fireartist at gmail.com> wrote:

>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?

I couldn't find it used anywhere else. I chose that name based 
on how InflateColumn::Object::Enum uses `is_enum` and 
InflateColumn::Boolean uses `is_boolean`.

So really the patch I'm offering should maybe instead look like 
(although assigning arrays doesn't seem to be preferred usage 
for InflateColumn::Object::Enum):

     my $value = ( $dbic->result_source->has_column($accessor)
              and (exists $dbic->result_source->column_info($accessor)->{is_array}
                or exists 
$dbic->result_source->column_info($accessor)->{is_enum} ) )
         ? $form->param_array( $field->nested_name )
         : $form->param_value( $field->nested_name ) ;

I considered creating InflateColumn::Array but it seemed 
overkill. If it ever does get created, I expect it will use `is_array`.

Putting the `is_array` specifier in the dbic schema code made 
more sense to me. I could also see it being an attribute of ff 
field/element model_config too. Either way works for my needs. 
Just as along as I've got same way to get `$form->param_array` 
rather than `$form->param_value` to assign to the column.


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