/** * Returns true if $user can delete this currency * * @param User $user * @return boolean */ function canDelete($user) { return !$this->getIsDefault() && $user->isAdministrator() && Invoices::countByCurrency($this) == 0; }