コード例 #1
0
 /**
  * @param int $limit
  * @param boolean $all
  * @return \FlickrDownloadr\Photoset\Photoset[];
  */
 private function getPhotosets($limit, $all)
 {
     if ($limit <= 0) {
         $limit = static::DEFAULT_LIMIT;
     }
     if ($all === TRUE) {
         $limit = NULL;
     }
     return $this->photosetRepository->findAll($limit);
 }
コード例 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     list($id, $noSlug, $dryRun, $dir, $photoSize, $cleanDir, $photoFilename) = $this->getInputParams($input);
     $photoset = $this->photosetRepository->findOne($id);
     $dirName = $this->managePhotosetDir($photoset, $noSlug, $dryRun, $dir, $cleanDir);
     $photos = $this->photoRepository->findAllByPhotosetId($id, $photoSize);
     $output->writeln('<info>Number of items in set: ' . count($photos) . '</info>' . PHP_EOL);
     $i = 1;
     $downloader = $this->downloaderFactory->create($output, $dryRun);
     foreach ($photos as $photo) {
         $filename = $this->photoFilenameCreator->create($photo, $i, count($photos), $photoFilename, $photoSize, $noSlug);
         $downloader->download($photo, $filename, $dirName);
         $i++;
     }
 }