package Foo; use Schema; use Fey::ORM::Table; use Fey::SQL; use Fey::Placeholder; my $schema = Schema->Schema(); my $foo_table = $schema->table( 'foo' ); my $bar_table = $schema->table( 'bar' ); my $writer_xref = $schema->table( 'bar_xref' ); has_table $foo_table; my $sql = Fey::SQL->new_select(); $sql->select( 'bar_id' ); $sql->from( $bar_xref ); $sql->where( $bar_xref->column( 'foo_id' ), '=', Fey::Placeholder->new ); has_many 'bars' => ( table => $schema->table('bar'), select => $sql, bind_params => sub { $_[0]->id }, ); 1; #### Use of uninitialized value in join or string at /usr/lib/perl5/site_perl/5.8.8/Fey/ORM/Role/Iterator.pm line 20. Attribute (classes) does not pass the type constraint because: Must be an array reference of Fey::Object::Table subclasses and you passed [] at /usr/lib/perl5/site_perl/5.8.8/Fey/Meta/HasMany.pm line 98 Foo::bars('Movie=HASH(0x9322704)') called at ./foo.pl line 11