tisql allow you more than just matching an additional column by a constant, consider:
<<< Group column cgm refers_to RT::Model::CGMCollection by 'group'; column gm refers_to RT::Model::GMCollection by 'group'; Ticket column watcher_groups refers_to RT::Model::GroupCollection by tisql => 'watcher_groups.Instance = .id AND watcher_groups.domain = "Ticket-Role" AND watcher_groups.type = "__1__"' column user_watchers refers_to RT::Model::UserCollection by tisql => 'user_watchers.id = .watcher_groups{__1__}.cgm.member' >>> This example uses the second syntax as I think to stop on it and shows two things: 1) long reference - "user_watchers.id = .watcher_groups.cgm.member" - where target collection is referenced via external table. 2) Place holders - $ticket->user_watchers('cc', 'requester') - I'm not totally sure about syntax, but I'm pretty sure it would be sexy. Read also comments below. On Sat, Aug 2, 2008 at 10:13 PM, Chia-liang Kao <[EMAIL PROTECTED]> wrote: >> From time to time I'm hacking on tisql branch of JDBI and I have a >> question for you. In the following list what does look more natural >> and descriptive? I don't describe what this is as it should be self >> descriptive. Vote for any you think is clearer and better. > > > The current (verbose) version we have is: > > refers_to Foo::Model::AttrCollection by 'foreign_column_for_foo'; it's not verbose, but the only way to reference a collection. > > how about making extend that with more constraints like > > refers_to Foo::Model::AttrCollection by 'foreign_column_for_foo', > tisql matching model => 'User' ? I can implement this in a hour without any tisql things for prefetch, accessor and other JDBI's method, but it will be solving a small, may be popular, but small problem. I don't mind against an API instead of strings, but as long it will be sane and extendable. > > and of course we can translate to whatever underlying internal tisql > representation. > >> 1) >> >> package TestApp::User; >> ... >> use Jifty::DBI::Record schema { >> ... >> column attrs => >> refers_to TestApp::AttributeCollection >> by tisql => " .record = __record__.id AND .model = 'User'"; >> ... >> }; >> >> 2) >> >> package TestApp::User; >> ... >> use Jifty::DBI::Record schema { >> ... >> column attrs => >> refers_to TestApp::AttributeCollection >> by tisql => "attrs.record = .id AND attrs.model = 'User'"; >> ... >> }; >> >> 3) >> >> package TestApp::User; >> ... >> use Jifty::DBI::Record schema { >> ... >> column attrs => >> refers_to TestApp::AttributeCollection >> by tisql => ".attrs.record = .id AND .attrs.model = >> 'User'"; >> ... >> }; >> >> >> -- >> Best regards, Ruslan. >> _______________________________________________ >> jifty-devel mailing list >> jifty-devel@lists.jifty.org >> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel >> > > _______________________________________________ > jifty-devel mailing list > jifty-devel@lists.jifty.org > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel > -- Best regards, Ruslan. _______________________________________________ jifty-devel mailing list jifty-devel@lists.jifty.org http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel