/** * Return number of invoices that use $currency * * @param Currency $currency * @return integer */ function countByCurrency($currency) { return Invoices::count(array('currency_id = ?', $currency->getId())); }