[Dbix-class] How to grep field types?

RA Jones ra.jones at dpw.clara.co.uk
Fri May 11 11:51:45 GMT 2007


Matt S Trout wrote:
> On Fri, May 11, 2007 at 10:42:56AM +0100, RA Jones wrote:
>   
>> Using formbuilder object in the controller and InflateColumns::DateTime 
>> in the model, it should be possible to retrieve field definitions like:
>>
>> my $form = $self->formbuilder; # CCF object
>> my @date_fields = grep { $_->get_field_types } keys %{ $form->field };
>>
>> I just can't work out what get_field_types in the grep block should be.
>>     
>
> $schema->source('Foo')->column_info($_)->{data_type} eq 'datetime'
>
>   
In a Cat controller, the equivalent of $schema->source('Foo') is 
$c->model->('Schema::Foo') ?

Possibly not as:

my @date_fields = grep { 
$c->model('Schema::Foo')->column_info($_)->{data_type} eq 'date' } keys 
%{ $form->field };

generates:

|"Can't locate object method "column_info" via package "DBIx::Class::ResultSet" at .... etc 

I've tried a few variations (eg using an $rs from a search) but essentially get the same the error.
--
Richard Jones
|



**********************************************************************
This message  may  contain  confidential  and  privileged information.
If you are not  the intended  recipient please  accept our  apologies.
Please do not disclose, copy or distribute  information in this e-mail
or take any  action in reliance on its  contents: to do so is strictly
prohibited and may be unlawful. Please inform us that this message has
gone  astray  before  deleting it.  Thank  you for  your co-operation.

NHSmail is used daily by over 100,000 staff in the NHS. Over a million
messages  are sent every day by the system.  To find  out why more and
more NHS personnel are  switching to  this NHS  Connecting  for Health
system please visit www.connectingforhealth.nhs.uk/nhsmail
**********************************************************************




More information about the Dbix-class mailing list