/** * @param Customer $customer * @param $accentCardNumber * @return bool */ public function removeAccentCard(Customer $customer, $accentCardNumber) { $galittProvider = $this->galittProvider; $found = false; /** @var Customer\AccentCard $accentCard */ foreach ($customer->getAccentCards() as $accentCard) { if ($accentCard->getNumber() == $accentCardNumber) { $customer->removeAccentCard($accentCard); $found = true; } } if ($found) { try { $galittProvider->updateAccountFidelity($customer); } catch (\Exception $e) { return false; } } return true; }