[Dbix-class] Bug with relationships on new objects.
Matt S Trout
dbix-class at trout.me.uk
Wed Jan 23 06:03:16 GMT 2008
On Wed, Jan 23, 2008 at 09:45:16AM +1100, brett gardner wrote:
> Test case below
If the column doesn't exist it should die - since that means "no idea",
not "is null" (which is exists && !defined)
"returns nothing" is slightly less dangerous than "reutnrs everything" but
it's still wrong.
Could you try just removing the has_column_loaded check in the code in
question and see if the rest of the tests still pass?
> Index: 0.09/trunk/t/66relationship.t
> ===================================================================
> --- 0.09/trunk/t/66relationship.t (revision 3935)
> +++ 0.09/trunk/t/66relationship.t (working copy)
> @@ -211,6 +211,10 @@
> is($def_artist_cd->has_column_loaded('artist'), 1, 'FK loaded');
> is($def_artist_cd->search_related('artist')->count, 0, 'closed search
> on null FK');
>
> +my $undef_artist = $schema->resultset('Artist')->new_result({name=>'foo'});
> +is($undef_artist->has_column_loaded('artist_id'),'','PK not set');
> +is($undef_artist->search_related('cds')->count,0,'Open search on undef
> PK');
> +
> # test undirected many-to-many relationship (e.g. "related artists")
> my $undir_maps =
> $schema->resultset("Artist")->find(1)->artist_undirected_maps;
> is($undir_maps->count, 1, 'found 1 undirected map for artist 1');
>
>
> _______________________________________________
> 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.rawmode.org
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list