Subject: | AbstractCount fails if Class::DBI::accessor_name is used |
I just tried to use Class::DBI::Plugin::AbstractCount in place of Class::DBI::Plugin::CountSearch for compatibility with another plugin (Class::DBI::Plugin::Pager). My call was:
__PACKAGE__->count_search_where({relationship => $relation});
This failed with the following message:
DBD::mysql::st execute failed: Unknown column 'relationship' in
'where clause' [for Statement "
SELECT COUNT(*)
FROM members
WHERE ( relationship = ? )
"] at
/usr/local/share/perl/5.6.1/DBIx/ContextualFetch.pm line 51.
...
Now my column is called relationship_id, whilst its accessor is called relationship (set using Class::DBI::accessor_name). CountSearch handles this properly, but looking at the AbstractCount source, it doesn't seem to have any knowledge of accessor names vs column names.
This seems like a big omission; it's a showstopper for me. Have I missed something?
The docs say: "This Class::DBI plugin combines the functionality from Class::DBI::Plugin::CountSearch ..." so if a fix is not possible, perhaps a warning in the docs would be appropriate.
Cheers, Dave