On Thu, May 21, 2009 at 06:27:45PM -0700, David Ihnen wrote: > Is this appropriate behavior or a bug? > > Consider this code here. It is part of our application's database test > script. Its purpose is to hit every rel defined in the database so that > we can get an early warning on any class configuration mismatching the > state of the database. > > # get all the sources > my $sources = $user->result_source->schema->{'source_registrations'};
Read the DBIx::Class::Schema docs and call the methods fore this. > # grab all the registered sources > foreach my $source (keys %{$sources}) { > # grab all their relationships > foreach my $rel (keys %{$sources->{$source}->{'_relationships'}}) { Read the DBIx::Class::ResultSource docs and call the methods fore this. > eval { > my $row = $DBH->resultset($source)->single; > $row->$rel if ($row) > }; > print "$...@\n" if ($@); > ok(!$@, "test rel $source->$rel" ); > } > } > > Runnign this eventually prints out this message here > > DBIx::Class::Relationship::Accessor::__ANON__(): Column dependency_id > not loaded or not passed to new() prior to insert() on > DB::Schema::cron_task=HASH(0x2fa4940) trying to resolve relationship > (maybe you forgot to call ->reload_from_storage to get defaults from the > db) at 02_db.t line 40 > not ok 563 - test rel cron_task->dependency That should be an exists check, not a defined check. If dependency_id is in the normal column list it should be fine. -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.uk http://shadowcat.co.uk/blog/matt-s-trout/ _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk