[Catalyst] CDBI::Sweet and accessor_name

Matt S Trout dbix-class at trout.me.uk
Tue Oct 25 19:44:27 CEST 2005


On Tue, Oct 25, 2005 at 11:27:57AM -0500, Cory Watson wrote:
> The CDBI::Sweet documentation says to ask questions here, so I shall.
> 
> When I add Sweet to the mix (by changing my Foo/DBI.pm to use base  
> Class::DBI::Sweet) has_many relationships start acting silly.  When I  
> try to delete a Category which is mapped to a Product via a  
> ProductCategory class, link table, and has_many(categories =>  
> ['Foo::ProductCategory' => 'category']) I get an error.  The error  
> stems from the fact that I have an accessor_name method which trims  
> '_id$' from the end of any accessors.  In other words, category_id  
> and product_id accessors become 'product' and 'category'.
> 
> This seems to confuse Sweet.  Removing it puts things back to  
> normal.  Then I lose that lovely page() method that sweet adds.  I  
> want have my Sweets and eat them too! ;)

Sweet's search stuff etc. doesn't currently account for accessor_name
and mutator_name, unfortunately.

A patch to add such would certainly be well-received; I don't think any
of the authors use that feature of CDBI so it's unlikely to float to the
top of our todo lists anytime soon.

-- 
     Matt S Trout       Specialists in Perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list