[CDBI] has_many self reference
[prev]
[thread]
[next]
[Date index for 2006/02/05]
So, I'm trying to do this:
Table def:
CREATE TABLE entry {
id INT PRIMARY KEY,
parent INT
}
Perl code:
package Entry;
use base 'My::DB'; #inherits from Class::DBI::AutoLoader
__PACKAGE__->has_a(parent => 'Entry');
__PACKAGE__->has_many(children => ['Entry', 'parent']);
1;
And I get the error:
Couldn't load "Entry", "Can't locate object method "meta_info" via
package "Entry" at
/usr/local/lib/perl5/site_perl/5.8.7/Class/DBI/Relationship/HasMany.pm
line 34
I've been playing with this, trying to put it after the 1; with the
__PACKAGE__ as Entry->, and none of it is working, I keep getting the same.
I have collapsed the info above, by the way. I'm trying to make a table
that stores both the main entries and any comments for a blog (yes,
another blog, sorry), and this just seemed like the most natural way to
model it. Any thoughts?
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
[CDBI] has_many self reference
Hunter Thomas 15:37 on 05 Feb 2006
|