Fix xPDO::getCount() to work with queries containing group by

Closes modxcms/revolution#513
Merge remote-tracking branch 'xpdo/develop' into develop

* xpdo/develop:
  Fix xPDO::getCount() to work with queries containing group by