/**
  * Creates a new entity of the given type and relates it with the given imported record.
  *
  * @param RepositoryInterface $repository
  * @param string $entityClass
  * @param array $importedRecord
  * @return \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
  */
 protected function createEntityAndStoreImportedUid($repository, $entityClass, array $importedRecord)
 {
     $entity = $this->objectManager->get($entityClass);
     if (!$entity instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractEntity) {
         throw new \RuntimeException('The entity class must be an instance of AbstractEntity');
     }
     if (isset($importedRecord['pid'])) {
         $entity->setPid($importedRecord['pid']);
     }
     $repository->add($entity);
     $this->persistenceManager->persistAll();
     $entityTableName = $this->dataMapper->getDataMap($entityClass)->getTableName();
     $this->getDatabaseConnection()->exec_UPDATEquery($entityTableName, 'uid=' . (int) $entity->getUid(), ['tx_czsimplecalimportercal_imported_uid' => (int) $importedRecord['uid']]);
     return $entity;
 }
Example #2
0
 /**
  * @param array          $configuration
  * @param AbstractEntity $model
  * @param $entry
  */
 protected function processLanguageEntries(array $configuration, $model, $entry)
 {
     foreach ($configuration as $languageKey => $mapping) {
         $modelLang = $this->mapModel($this->getModel(), $mapping, $entry);
         if (method_exists($modelLang, 'setSysLanguageUid') && method_exists($modelLang, 'setL10nParent')) {
             $modelLang->setSysLanguageUid($languageKey);
             $modelLang->setL10nParent($model);
             $this->repository->add($modelLang);
         }
     }
 }