Created
August 23, 2011 11:55
-
-
Save dotandimet/1164933 to your computer and use it in GitHub Desktop.
Trying to understand DBIx::Class::CDBICompat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Unity::DBI; | |
use base qw/DBIx::Class::CDBICompat/; | |
package Unity::Cluster; | |
use base 'Unity::DBI'; | |
__PACKAGE__->table('u_clusters'); | |
__PACKAGE__->table_alias('u_clusters'); | |
__PACKAGE__->sequence('obj_id'); | |
__PACKAGE__->columns(Primary => qw/id/); | |
__PACKAGE__->columns(Others => qw/name description/); | |
package Unity::Sequence; | |
use base 'Unity::DBI'; | |
__PACKAGE__->table('u_sequences'); | |
__PACKAGE__->table_alias('u_sequences'); | |
__PACKAGE__->sequence('obj_id'); | |
__PACKAGE__->columns(Primary => qw/id/); | |
__PACKAGE__->columns(Essential => qw/name accession type /); | |
package Unity::Clustering; | |
use base 'Unity::DBI'; | |
__PACKAGE__->table('u_clustering'); | |
__PACKAGE__->columns(Primary => qw/cluster_id sequence_id/); | |
__PACKAGE__->has_a('cluster_id' => 'Unity::Cluster'); | |
__PACKAGE__->has_a('sequence_id' => 'Unity::Sequence'); | |
# Now that Unity::Cluster, Unity::Sequence and Unity::Clustering have been | |
# defined, I should be able to define a has_many mapping? | |
Unity::Sequence->has_many(clusters => [qw(Unity::Clustering cluster_id)]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The exception stack (via debugger):
at /disk/software/lib/perl5/site_perl/5.8.7/DBIx/Class/Exception.pm line 72
DBIx::Class::Exception::throw('DBIx::Class::Exception', 'No such column sequence on foreign class Unity::Clustering (u...') called at /disk/software/lib/perl5/site_perl/5.8.7/DBIx/Class/Row.pm line 1449
DBIx::Class::Row::throw_exception('Unity::Sequence', 'No such column sequence on foreign class Unity::Clustering (u...') called at /disk/software/lib/perl5/site_perl/5.8.7/DBIx/Class/Relationship/HasMany.pm line 45
DBIx::Class::Relationship::HasMany::has_many('Unity::Sequence', 'clusters', 'Unity::Clustering', '', 'HASH(0x36a1f80)') called at /disk/software/lib/perl5/site_perl/5.8.7/DBIx/Class/CDBICompat/Relationships.pm line 109
DBIx::Class::CDBICompat::Relationships::has_many('Unity::Sequence', 'clusters', 'ARRAY(0x3a19940)', '') called at /disk/software/lib/perl5/site_perl/5.8.7/DBIx/Class/CDBICompat/ColumnCase.pm line 28
DBIx::Class::CDBICompat::ColumnCase::has_many('Unity::Sequence', 'clusters', 'ARRAY(0x3a19940)') called at C2Ssimp.pm line 32