[Dbix-class] Subclass a Result class.
Bill Moseley
moseley at hank.org
Thu Apr 29 19:49:30 GMT 2010
On Wed, Apr 28, 2010 at 7:27 AM, Matt S Trout <mst at shadowcat.co.uk> wrote:
> > For that to happen the $session_attendee needs to be specific to a given
> > session (Session id is stored with the $session_attendee instance).
>
> You just answered your own question.
>
> You want a result from the many-many link table and to traverse from ther=
e,
> since that table has (session_id, attendee_id).
>
That seems to reason, yes. Sadly, I'm not seeing the implementation so I
ask for a bit more help.
Again, what I'm after is:
$session_one =3D $schema->resultset( 'Session' )->find( 1 );
$session_one_attendees =3D $session_one->attendees;
$first_user_session_one_notes =3D $session_one_attendees->first->notes;
Which makes me think I should be able to do the reverse with
$session_one_attendees->first->session and get the original Session object
back. That is, the $session_one_attendees->all are a subclass of Attendee
with an extra "Session" attribute. These attendees 'know" how they were
created.
Thanks,
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20100429/41e=
7ef09/attachment.htm
More information about the DBIx-Class
mailing list