From: Chris W. <ch...@cw...> - 2003-04-21 22:09:44
|
Nick Sutterer wrote: > how is it possible to create more than one accessor to a "links_to" > property in a SPOPS object? SPOPS automatically creates one method which > is named according to the object alias: > > 'object_alias' => { class => My::Object, > alias => ['blabla'],... }, > 'another_object' => { .... > links_to => { 'My::Object' => 'some_linking_table' } > } > > here, an object of type 'another_object' would have one method named > 'object_alias' to get the contained objects. although i set an alias in > 'object_alias', there is only one accessor in 'another_object', there > should be another accessor called 'blabla'. is this correct behaviour? Interesting, this has never come up before. I'm going to take the lazy way out and say that instead of making the code generation more convoluted -- that is, work for me -- you should probably create a couple of aliases in your code class -- work for you, but very easy: sub blabla { my ( $self, @params ) = @_; return $self->object_alias( @params ); } sub blabla_add { my ( $self, @params ) = @_; return $self->object_alias_add( @params ); } sub blabla_remove { my ( $self, @params ) = @_; return $self->object_alias_remove( @params ); } > what happens, if a field and a links_to object have the same name? If this happens you should probably rename one of the two :-) Seriously, the relationship declaration syntax is so ugly right now that I hesitate to add any complexity to it to handle special cases. Later, Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |