[Dbix-class] trouble with relationships

Devin Austin devin.austin at gmail.com
Fri Nov 3 07:44:35 GMT 2006


when using my @all_user_notes =3D $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 =3D
> $schema->resultset('User')->search( username =3D> $username )->notes;
>
> Easier, if you've already got the user object instantiated.
> my @all_user_notes =3D $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 =3D $user_notes->search_related('notes',
> >         {
> >             username =3D> $session->param('username')
> >         }
> >     );
> >     my @user_notes =3D map {
> >         {
> >             'noteid'    =3D> $_->noteid,
> >             'number'    =3D> $_->number,
> >             'date'      =3D> $_->date,
> >             'private'   =3D> $_->private,
> >         }
> >     } @all_user_notes;
> >
> > And I'm getting this when I run Data::Dumper on @user_notes:
> >
> > $VAR1 =3D {
> >           'number' =3D> undef,
> >
> >           'date' =3D> undef,
> >           'private' =3D> undef,
> >           'noteid' =3D> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jules.scsys.co.uk/pipermail/dbix-class/attachments/20061103/431=
c5ce3/attachment.htm


More information about the Dbix-class mailing list