Re: [CDBI] Making Class::DBI objects from a search_ method result?

[prev] [thread] [next] [Date index for 2005/10/24]

From: Perrin Harkins
Subject: Re: [CDBI] Making Class::DBI objects from a search_ method result?
Date: 16:07 on 24 Oct 2005
On Mon, 2005-10-24 at 16:41 +0100, Steven Mackenzie wrote:
> I saw some discussion of sth_to_objects a few days back, but I'm still
> not sure of the usage. Is that something I could use in this situation?

The search method actually does it for you.  No doubt the
Class::DBI::Sweet method works, but your approach with the set_sql is
fine, and should work with no problems.  The only issue I see with what
you wrote is that the query belongs in your Person class, not in your CD
class, and you need to put in a placeholder for the cdid, not
$self.cdid.

So you'd call it like this:
my @persons = Person->search_by_cd( $cd->id() );

That should give you a list of Person objects.

- Perrin


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] Making Class::DBI objects from a search_ method result?
Perrin Harkins 16:07 on 24 Oct 2005

Generated at 14:18 on 27 Oct 2005 by mariachi v0.52