public function sendNotifications(Form $form, $values) { $messages = []; foreach ($this->newListings as $listing) { $message = $this->sharedListingNotification->getNotificationMessage($listing, $this->user->getIdentity()->username, $this->users[$listing->getOwnerID()]); $messages[$listing->getOwnerID()] = $message; } try { $this->messagesFacade->sendMessages($messages); } catch (\DibiException $e) { $this->presenter->flashMessage('Nepodařilo se odeslat upozornění příjemcům.', 'warning'); $this->redirect('this'); } $this->redirect('this'); }