/** * Return number of items that user $rate tax rate * * @param TaxRate $tax_rate * @return integer */ function countByTaxRate($tax_rate) { return InvoiceItems::count(array('tax_rate_id = ?', $tax_rate->getId())); }