public function processSaveItem(Form $form, $values) { $values['day'] = $this->day; $values['listing'] = $this->listing; $values['user'] = $this->listing->getUser(); $this->listingItem = $this->itemsFacade->getByDay($this->day, $this->listing); try { $this->listingItem = $this->itemsFacade->saveListingItem((array) $values, $this->listingItem); } catch (OtherHoursZeroTimeException $zt) { $form->addError(ItemUpdateFormFactory::OTHER_HOURS_ZERO_TIME_ERROR_MSG); return; } catch (NegativeResultOfTimeCalcException $b) { $form->addError('Položku nelze uložit. Musíte mít odpracováno více hodin, než kolik strávíte obědem.'); return; } catch (ShiftEndBeforeStartException $c) { $form->addError('Nelze skončit směnu dřív než začne. Zkontrolujte si začátek a konec směny.'); return; } catch (ListingItemDayAlreadyExistsException $d) { $form->addError('Položku nelze uložit, protože výčetka již obsahuje záznam z tohoto dne.'); return; } catch (\Exception $e) { $form->addError('Položka nebyla uložena. Zkuste akci opakovat později.'); return; } $this->onSuccessItemPersist($this->listingItem); }
public function getNotificationMessage(Listing $newListing, User $sender) { $period = TimeUtils::getMonthName($newListing->month) . ' ' . $newListing->year; $m = new SentMessage($this->constructSubject($sender->username, $period), $this->constructMessage($sender->username, $newListing->getUser()->username, $period, $this->linkGenerator->link('Front:Listing:detail', ['id' => $newListing->getId()])), $sender); return $m; }