Re: Threaded posts with a single table
[prev]
[thread]
[next]
[Date index for 2004/08/04]
# sorry, Perrin, didn't reply all the first time (don't use this client
usually, sigh)
> On Wed, 2004-08-04 at 17:10, jinx@xxxxxxx.xxx wrote:
>> __PACKAGE__->might_have(parent => __PACKAGE__);
>> __PACKAGE__->has_many(replies => __PACKAGE__);
>
> I would change that might_have to this:
> __PACKAGE__->has_a(parent => __PACKAGE__);
Sure thing. I had it that way first but wasn't sure since a post could be
original (parentless).
> I also like the explicit form of has_many instead of the magical form
> you're using there:
> __PACKAGE__->has_many(replies => __PACKAGE__, 'parent');
>
>> So, the "parent" I can see working fine. It's just pointing to a
>> "foreign" id in its own table. It's the "replies" that obviously won't
>> work that way.
>
> What makes you think that?
The relative density of my gray matter, I fear. CDBI relations can be a
bit magical/confusing to me. That looks great if it does what I think it
does. I also noticed that the POD for CDBI is much fuller now than it was
a few versions back (or else I'm just understanding more now) so I have
some reading to catch up on.
Thanks for the help. And to Simon, of course!
http://search.cpan.org/search?query=Email%3A%3AStore%3A%3AThread&mode=all
is very interesting code.
-Ashley