@Peet86
Sorry, I just don’t know how to help you here. Most likely the only way you are going to get DataMapper (or DMZ) to work with what you want is to change your structure, or rethink your design.
@nmac
You can perform normal ActiveRecord-like queries with DM and DMZ. DMZ lets you include fields that are not on the table (such as “COUNT(column) as column_total”), and you can use the normal group_by to group your query rows.
I’m not sure you will benefit much speed by trying to do this, however, unless your DataBase is on another server and not connected to the same LAN. Remember that the counting is done on the server either way.
I really think just calling $tag->article->count() will be pretty fast, easier to read, and save you the headache of maintaining a custom command if things get changed later.