[Dbix-class] How to grep field types?

Matt S Trout dbix-class at trout.me.uk
Fri May 11 12:49:51 GMT 2007


On Fri, May 11, 2007 at 11:51:45AM +0100, RA Jones wrote:
> 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') ?

Nope.

$c->model('Schema')->schema->source('Foo')

or

$c->model('Schema::Foo')->result_source

see the Catalyst::Model::DBIC::Schema, DBIx::Class::Schema,
DBIx::Class::ResultSet and DBIx::Class::ResultSource POD for more info.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list