From: Stathy G. T. <st...@ed...> - 2003-11-11 17:04:11
|
In a 'links-to' relationship is it possible to specify the id field of the linking table as is possible in a 'has-a' relationship? |
From: Chris W. <ch...@cw...> - 2003-11-11 19:28:04
|
Stathy G. Touloumis wrote: > In a 'links-to' relationship is it possible to specify the id field of > the linking table as is possible in a 'has-a' relationship? Not right now. It's a fairly easy add, so I'll do so for 0.80. (The whole configuration for relationships is a mess tho, and may be seriously revamped in the future...) Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |
From: Stathy G. T. <st...@ed...> - 2003-11-12 17:37:50
|
So would you recommend rolling my own relationship config to prevent upgrade conflicts? Are there samples or code I could be pointed to for doing this in the SPOPS config? Thanks, >>In a 'links-to' relationship is it possible to specify the id field of >>the linking table as is possible in a 'has-a' relationship? > >Not right now. It's a fairly easy add, so I'll do so for 0.80. (The whole >configuration for relationships is a mess tho, and may be seriously >revamped in the future...) |
From: Chris W. <ch...@cw...> - 2003-11-12 17:51:07
|
Stathy G. Touloumis wrote: > So would you recommend rolling my own relationship config to prevent > upgrade conflicts? Are there samples or code I could be pointed to for > doing this in the SPOPS config? I'm going to put out SPOPS 0.80 shortly (next day or two). But the configuration will look like this: # old way, still works links_to => { 'Other::Object' => 'link_table' }, # optional new way links_to => { 'Other::Object' => { table => 'link_table', to_id_field => 'my_id', from_id_field => 'your_id', alias => 'othername' }, }, If you look in CVS you can see the docs for this: http://cvs.sourceforge.net/viewcvs.py/spops/SPOPS/doc/Manual/Relationships.pod?rev=3.2&view=auto Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |
From: Stathy G. T. <st...@ed...> - 2003-11-17 23:32:23
|
I was wondering open_interact has built in support for packages interacting with each other. More specifically I would like to add 'links' to the 'box' of one application from another application. This would be similar to how you can do this with boxes in general. Thanks, |
From: Chris W. <ch...@cw...> - 2003-11-18 15:32:42
|
Stathy G. Touloumis wrote: > I was wondering open_interact has built in support for packages > interacting with each other. More specifically I would like to add > 'links' to the 'box' of one application from another application. This > would be similar to how you can do this with boxes in general. Nothing is built-in. Packages communicate with each other like everything else in OI, through common names of registered components. This is normally seen in two ways: - SPOPS object name-to-class mappings 1.x: my $object_class = $R->object_name 2.x: my $object_class = CTX->lookup_object( 'object_name' ) - Action handler name-to-class mappings 1.x: my $action_info_hash = $R->lookup_action( 'action_name', { return => 'info } ); 1.x: my ( $action_class, $method ) = $R->lookup_action( 'action_name' ); 2.x: my $action_obj = CTX->lookup_action( 'action_name' ); my $action_name = CTX->lookup_action_name( 'url' ); my $action_info_hash = CTX->lookup_action_info( 'action_name' ); In 1.x you can also use $R to pass around information as necessary. It's a little hackish (that is, not built-in) but it's fairly easy to do, and all your packages need to agree on is what name to use ('tmp_box_links' in the example below). For instance, in your box handler you could have: sub handler { my ( $class, $params ) = @_; # These are the links used in the box call my $my_links = $params->{links} || []; # These are the links added by other people my $other_links = $R->{tmp_box_links} || []; my @all_links = ( @{ $my_links }, @{ $other_links } ); return $R->template->handler( {}, { links => \@all_links }, { name => 'mypkg::tmpl' } ); } Since OI 2.x represents all actions, including boxes, as objects you can store state in them from anywhere you wish. Much more flexible. Hope this helps, Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |