[CDBI] has_a and null foreign keys
"Arshavir Grigorian" <[email protected]> Mon, 9 Apr 2007 19:50:07 -0700
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Hi, I have 2 tables that are related to each other through has_a relationship in Class::DBI. However, it can happen that a record in table1 does not have the foreign key for table2 populated. In this situation, if I try to call My::Class->retrieve(id => $id)->foreign_key->column_in_table2(), I get an error because foreign_key() didn't return a valid object and column_in_table2() fails. Should I be trying to check whether ->foreign_key() returns a valid object and only then call column_in_table2() or is there another way? Thanks Arsh _______________________________________________ ClassDBI mailing list ClassDBI-Ra3b/[email protected] http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi