コード例 #1
0
 /**
  * Import item
  *
  * @param ImportSource $importSource
  * @param string $guid
  * @return string
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
  */
 public function importAction(ImportSource $importSource, $guid)
 {
     $this->extractorService->setSource($importSource->getUrl());
     $this->extractorService->setMapping($importSource->getMapping());
     $extractedItems = $this->extractorService->getItems();
     foreach ($extractedItems as $item) {
         if ($item->getGuid() === $guid) {
             $this->importService->importItem($importSource, $item);
             $itemUid = $this->importService->alreadyImported($importSource->getPid(), $guid);
             $this->uriBuilder->reset()->setCreateAbsoluteUri(TRUE);
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
                 $this->uriBuilder->setAbsoluteUriScheme('https');
             }
             $returnUrl = $this->uriBuilder->uriFor('show', array('importSource' => $importSource), $this->request->getControllerName());
             $this->redirectToUri('alt_doc.php?returnUrl=' . rawurlencode($returnUrl) . '&edit[tx_news_domain_model_news][' . $itemUid . ']=edit&disHelp=1');
         }
     }
     $this->addFlashMessage('requested-item-not-found', '', AbstractMessage::ERROR);
     $this->redirect('show', NULL, NULL, array('importSource' => $importSource));
 }
コード例 #2
0
 /**
  * Test import source by counting found items and displaying data of first item
  *
  * @param ImportSource $importSource
  */
 public function testSourceCommand(ImportSource $importSource)
 {
     $this->outputLine('Fetch: ' . $importSource->getUrl());
     $this->outputDashedLine();
     $this->extractorService->setSource($importSource->getUrl());
     $this->extractorService->setMapping($importSource->getMapping());
     $items = $this->extractorService->getItems();
     $this->outputLine('Found ' . count($items) . ' items');
     $this->outputDashedLine();
     if (count($items)) {
         $this->outputLine('GUID: ' . $items[0]->getGuid());
         $this->outputDashedLine();
         $this->outputLine(print_r($items[0]->toArray(), 1));
     }
 }
コード例 #3
0
 /**
  * @test
  */
 public function getMappingReturnsInitialValueForString()
 {
     $this->assertSame('', $this->subject->getMapping());
 }