A. Pagaltzis wrote:
Hi RA,
* RA Jones <[EMAIL PROTECTED]> [2007-05-11 12:55]:
In a Cat controller, the equivalent of $schema->source('Foo')
is $c->model->('Schema::Foo') ?
that returns a ResultSet, not a ResultSource. You get the source
by asking the set for it using… uh… `result_source`.
my @date_fields = grep {
$c->model('Schema::Foo')->column_info($_)->{data_type} eq 'date' } keys
%{ $form->field };
That unnecessarily goes down the chain for every key in the hash.
my $src = $c->model('Schema::Foo')->result_source;
my @date_fields = (
grep { $src->column_info($_)->{data_type} eq 'date' }
keys %{ $form->field }
);
Regards,
Yep, that works, provided I use 'DATE' not 'date'. But because this
controller method is generating an sql 'where' from two schemas, I have
to do this:
foreach( qw/Schema::Foo Schema::Bar/ ) {
my $schema = $_;
my $src = $c->model($schema)->result_source;
push @date_fields, grep { $src->column_info($_)->{data_type} eq 'DATE'
} $src->columns;
}
which is why I wanted to use the $form object originally, as that
contains the combined fields from both Schemas.
One day I'll actually 'get' this stuff ;-)
--
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
**********************************************************************
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/