コード例 #1
0
ファイル: ItemPresenter.php プロジェクト: blitzik/vycetky
 public function renderEdit($id, $day)
 {
     $this->template->_form = $this['itemForm'];
     $workedHours = null;
     if ($this->listingItem instanceof Entities\ListingItem and !$this->listing->isDetached()) {
         $workedHours = $this->listingItem->workedHours->getHours();
     }
     $this->template->itemDate = $this->date;
     $this->template->listing = $this->listing;
     $this->template->workedHours = $workedHours;
     $this->template->defaultWorkedHours = $this->itemUpdateFormFactory->getDefaultTimeValue('workedHours');
 }
コード例 #2
0
ファイル: ItemService.php プロジェクト: blitzik/vycetky
 /**
  * @param Entities\ListingItem[] $listingItems
  * @param Entities\Listing $listing
  * @return array
  */
 public function setListingForGivenItems(array $listingItems, Entities\Listing $listing)
 {
     if ($listing->isDetached()) {
         throw new InvalidArgumentException('Only attached(not detached) ' . Entities\Listing::class . ' entity can pass!');
     }
     $newItemsCollection = [];
     foreach ($listingItems as $listingItem) {
         if (!$listingItem instanceof Entities\ListingItem) {
             throw new InvalidArgumentException('Only instances of ' . Entities\ListingItem::class . ' can pass.');
         }
         $listingItem->setListing($listing);
         $newItemsCollection[] = $listingItem;
     }
     return $newItemsCollection;
 }
コード例 #3
0
ファイル: ListingFacade.php プロジェクト: blitzik/vycetky
 /**
  * @param Listing $listing
  * @throws InvalidArgumentException
  */
 private function checkListingValidity(Listing $listing)
 {
     if ($listing->isDetached()) {
         throw new InvalidArgumentException('Argument $listing must be attached instance of ' . Listing::class);
     }
 }