[Dbix-class] trouble with relationships

Zbigniew Lukasiak zzbbyy at gmail.com
Fri Nov 3 14:48:17 GMT 2006


You say it returns nothing - but what kind of nothing it is?  Is it
undef, empty array or an array of one undef?

--
Zbyszek

On 11/3/06, Devin Austin <devin.austin at gmail.com> wrote:
> when using my @all_user_notes = $user->notes;  it still returns nothing.
>
> When using Data::Dumper (Dumper($user->notes)), it returns nothing as well.
>
> Ideas?
>
>
> On 11/2/06, Lee Standen <nom at standen.id.au> wrote:
> > my @all_user_notes =
> > $schema->resultset('User')->search( username => $username
> )->notes;
> >
> > Easier, if you've already got the user object instantiated.
> > my @all_user_notes = $user->notes;
> >
> > I think that does (a lot more simply) what you want.
> >
> >
> >
> >
> >
> > Devin Austin wrote:
> > > I'm using this code to attempt to retrieve a related table's info:
> > > my @all_user_notes =
> $user_notes->search_related('notes',
> > >         {
> > >             username => $session->param('username')
> > >         }
> > >     );
> > >     my @user_notes = map {
> > >         {
> > >             'noteid'    => $_->noteid,
> > >             'number'    => $_->number,
> > >             'date'      => $_->date,
> > >             'private'   => $_->private,
> > >         }
> > >     } @all_user_notes;
> > >
> > > And I'm getting this when I run Data::Dumper on @user_notes:
> > >
> > > $VAR1 = {
> > >           'number' => undef,
> > >
> > >           'date' => undef,
> > >           'private' => undef,
> > >           'noteid' => undef
> > >         };
> > >
> > > Why would all my fields be coming up empty?
> > >
> > > --
> > > timorperfectus.com <http://timorperfectus.com> - web design to
> > > frightening perfection.
> > >
> > >
> > > One last song
> > > Given to an Angel's Son
> > > As soon as you were gone
> > > As soon as you were gone
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > 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/dbix-class@lists.rawmode.org/
> >
> > _______________________________________________
> > 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/dbix-class@lists.rawmode.org/
> >
>
>
>
> --
>
>  timorperfectus.com - web design to frightening perfection.
>
>
> One last song
> Given to an Angel's Son
> As soon as you were gone
> As soon as you were gone
> _______________________________________________
> 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/dbix-class@lists.rawmode.org/
>
>


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the Dbix-class mailing list