[CDBI] Using a TEMP column with has_a?

Bill Moseley moseley at hank.org
Fri Jun 23 23:31:22 BST 2006


On Fri, Jun 23, 2006 at 05:13:02PM -0500, Jason Bodnar wrote:
> Currently, we have a class called PersonItem. It has two foreign keys --
> person_id and item_id that reference the person table and the item table. I
> wanted to make calls to $person_item->person_id() and $person_item->item_id()
> return Person and Item objects, respectively. I know I can do this with
> has_a() but that would break existing code that relies upon those methods
> returning an integer (the IDs).

How do you use that code such that it needs to be the value (integer)
instead of the object?  The objects stringify to the value so it
it's likely that setting has_a won't break existing code.

-- 
Bill Moseley
moseley at hank.org




More information about the ClassDBI mailing list