|Just another Perl shrine|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
Hello Monks! This is surely clearly written somewhere, but I haven't been able to figure out.
I have this example setup:
Using belongs_to it's easy to setup quick accessors and SQL magic like this:
... which in turn make it easy to get the one project induced by a quota, like this:
It's also easy to setup a convenience method, of course:
I have the feeling that this is a bit hackish though, as it does not provide hints for SQL optimizations (like being able to easily prefetch the project when fetching the quota).
Is there any quick way to add that project accessor that also eases the SQL generator life, e.g. for prefetching stuff? Or should I rely upon the convenience method written above, and then put a bit more effort for using prefetch correctly?
I was thinking about has_one but that seems to be confined to direct relationships between two tables, while here I have the ACCOUNT table providing a bridge (that is anyway NOT inducing a many_to_many, as there is only ONE account for a quota, and ONE project for an account, hence ONE project for a quota).
Thanks for any hint!
perl -ple'$_=reverse' <<<ti.xittelop@oivalfIo ho capito... ma tu che hai detto?
In reply to DBIx::Class two (or multiple) level has_one by polettix