當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StepExecution::getJobExecution方法代碼示例

本文整理匯總了PHP中Akeneo\Bundle\BatchBundle\Entity\StepExecution::getJobExecution方法的典型用法代碼示例。如果您正苦於以下問題:PHP StepExecution::getJobExecution方法的具體用法?PHP StepExecution::getJobExecution怎麽用?PHP StepExecution::getJobExecution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Akeneo\Bundle\BatchBundle\Entity\StepExecution的用法示例。


在下文中一共展示了StepExecution::getJobExecution方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getJobContext

 /**
  * @return ExecutionContext
  */
 protected function getJobContext()
 {
     if (!$this->stepExecution) {
         throw new \InvalidArgumentException('Missing StepExecution');
     }
     return $this->stepExecution->getJobExecution()->getExecutionContext();
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:10,代碼來源:StepExecutionAwareExportProcessor.php

示例2: testProcessWithoutCustomer

 public function testProcessWithoutCustomer()
 {
     /** @var NewsletterSubscriber $newsletterSubscriber */
     $newsletterSubscriber = $this->getReference('newsletter_subscriber2');
     $newsletterSubscriber->setCustomer(null);
     $em = $this->getContainer()->get('doctrine')->getManager();
     $em->persist($newsletterSubscriber);
     $em->flush($newsletterSubscriber);
     $this->strategy->setEntityName(get_class($newsletterSubscriber));
     $this->assertEquals($newsletterSubscriber, $this->strategy->process($newsletterSubscriber));
     $this->assertEmpty($this->stepExecution->getJobExecution()->getExecutionContext()->get('postProcessSubscribers'));
     $this->assertEmpty($this->stepExecution->getJobExecution()->getExecutionContext()->get('postProcessCustomerIds'));
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:13,代碼來源:NewsletterSubscriberWithExistingCustomerStrategyTest.php

示例3:

 function it_throws_an_exception_if_no_job_configuration_is_found($jobConfigurationRepo, StepExecution $stepExecution, JobExecution $jobExecution)
 {
     $stepExecution->getJobExecution()->willReturn($jobExecution);
     $jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution])->willReturn(null);
     $this->setStepExecution($stepExecution);
     $this->shouldThrow('Doctrine\\ORM\\EntityNotFoundException')->during('read');
 }
開發者ID:vpetrovych,項目名稱:pim-community-dev,代碼行數:7,代碼來源:FilteredFamilyReaderSpec.php

示例4: getExecutionContext

 /**
  * @return ExecutionContext
  */
 protected function getExecutionContext()
 {
     if (!$this->stepExecution) {
         throw new \InvalidArgumentException('Execution context is not configured');
     }
     return $this->stepExecution->getJobExecution()->getExecutionContext();
 }
開發者ID:heoffice,項目名稱:crm,代碼行數:10,代碼來源:AbstractImportStrategy.php

示例5: setJobConfiguration

 /**
  * Save the job configuration
  *
  * @param string $configuration
  */
 protected function setJobConfiguration($configuration)
 {
     $jobExecution = $this->stepExecution->getJobExecution();
     $massEditJobConf = $this->jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution]);
     $massEditJobConf->setConfiguration($configuration);
     $this->jobConfigurationSaver->save($massEditJobConf);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:12,代碼來源:VariantGroupCleaner.php

示例6: removeOption

 /**
  * {@inheritdoc}
  */
 public function removeOption($name)
 {
     if ($this->hasOption($name)) {
         $configuration = $this->getConfiguration();
         unset($configuration[$name]);
         $this->stepExecution->getJobExecution()->getJobInstance()->setRawConfiguration($configuration);
     }
 }
開發者ID:ramunasd,項目名稱:platform,代碼行數:11,代碼來源:StepExecutionProxyContext.php

示例7: setJobConfiguration

 /**
  * Save the job configuration
  *
  * @param string $configuration
  */
 protected function setJobConfiguration($configuration)
 {
     $jobExecution = $this->stepExecution->getJobExecution();
     $massEditJobConf = $this->jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution]);
     $massEditJobConf->setConfiguration($configuration);
     $this->objectManager->persist($massEditJobConf);
     $this->objectManager->flush($massEditJobConf);
 }
開發者ID:vpetrovych,項目名稱:pim-community-dev,代碼行數:13,代碼來源:MassEditVariantGroupCleaner.php

示例8: updateStepExecution

 /**
  * {@inheritdoc}
  */
 public function updateStepExecution(StepExecution $stepExecution)
 {
     $jobExecution = $stepExecution->getJobExecution();
     if ($jobExecution) {
         $this->updateJobExecution($jobExecution);
     }
     parent::updateStepExecution($stepExecution);
 }
開發者ID:ramunasd,項目名稱:platform,代碼行數:11,代碼來源:DoctrineJobRepository.php

示例9: getJobConfiguration

 /**
  * Return the job configuration
  *
  * @throws EntityNotFoundException
  *
  * @return array
  */
 protected function getJobConfiguration()
 {
     $jobExecution = $this->stepExecution->getJobExecution();
     $massEditJobConf = $this->jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution]);
     if (null === $massEditJobConf) {
         throw new EntityNotFoundException(sprintf('No JobConfiguration found for jobExecution with id %s', $jobExecution->getId()));
     }
     return json_decode(stripcslashes($massEditJobConf->getConfiguration()), true);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:16,代碼來源:FilteredFamilyReader.php

示例10: write

 /**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     /** @var EntityManager $em */
     $em = $this->registry->getManager();
     try {
         $em->beginTransaction();
         foreach ($items as $item) {
             $em->persist($item);
         }
         $em->flush();
         $em->commit();
         $configuration = $this->contextRegistry->getByStepExecution($this->stepExecution)->getConfiguration();
         $contextSkipClear = $this->stepExecution->getJobExecution()->getExecutionContext()->get(EntityWriter::SKIP_CLEAR);
         if (empty($configuration[EntityWriter::SKIP_CLEAR]) && !$contextSkipClear) {
             $em->clear();
         }
     } catch (\Exception $exception) {
         $em->rollback();
         if (!$em->isOpen()) {
             $this->registry->resetManager();
         }
         $jobName = $this->stepExecution->getJobExecution()->getJobInstance()->getAlias();
         $event = new WriterErrorEvent($items, $jobName, $exception);
         $this->eventDispatcher->dispatch(WriterErrorEvent::NAME, $event);
         if ($event->getCouldBeSkipped()) {
             $importContext = $this->contextRegistry->getByStepExecution($this->stepExecution);
             $importContext->setValue('error_entries_count', (int) $importContext->getValue('error_entries_count') + count($items));
             $this->logger->warning($event->getWarning());
             if ($event->getException() === $exception) {
                 // exception are already handled and job can move forward
                 throw new InvalidItemException($event->getWarning(), []);
             } else {
                 // exception are already created and ready to be rethrown
                 throw $event->getException();
             }
         } else {
             throw $exception;
         }
     }
     $this->eventDispatcher->dispatch(WriterAfterFlushEvent::NAME, new WriterAfterFlushEvent($em));
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:44,代碼來源:PersistentBatchWriter.php

示例11: getLastExecutionDate

 /**
  * Get the last successful execution date for the current job instance
  *
  * @return \DateTime||null
  */
 protected function getLastExecutionDate()
 {
     $query = $this->entityManager->createQuery(sprintf("SELECT MAX(e.endTime) FROM %s e WHERE e.jobInstance = :jobInstance AND e.exitCode = :completed", $this->jobExecutionClass));
     $query->setParameter('jobInstance', $this->stepExecution->getJobExecution()->getJobInstance());
     $query->setParameter('completed', ExitStatus::COMPLETED);
     $utcDateTime = $query->getOneOrNullResult();
     if (is_array($utcDateTime)) {
         $utcTimeZone = new \DateTimeZone('Etc/UTC');
         $utcDateTime = new \DateTime(reset($utcDateTime), $utcTimeZone);
     }
     $dateTime = new \DateTime();
     $dateTime->setTimestamp($utcDateTime->getTimestamp());
     return $dateTime;
 }
開發者ID:axel-ducret,項目名稱:EnhancedConnectorBundle,代碼行數:19,代碼來源:ProductReader.php

示例12: ConstraintViolation

 function it_adds_invalid_values_to_product($propertyAdder, $validator, ProductInterface $product, StepExecution $stepExecution, JobConfigurationRepositoryInterface $jobConfigurationRepo, JobExecution $jobExecution, JobConfigurationInterface $jobConfiguration)
 {
     $violation = new ConstraintViolation('error2', 'spec', [], '', '', $product);
     $violations = new ConstraintViolationList([$violation, $violation]);
     $validator->validate($product)->willReturn($violations);
     $stepExecution->getJobExecution()->willReturn($jobExecution);
     $jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution])->willReturn($jobConfiguration);
     $jobConfiguration->getConfiguration()->willReturn(json_encode(['filters' => [], 'actions' => [['field' => 'categories', 'value' => ['office', 'bedroom']]]]));
     $propertyAdder->addData($product, 'categories', ['office', 'bedroom'])->shouldBeCalled();
     $stepExecution->addWarning(Argument::cetera())->shouldBeCalled();
     $stepExecution->incrementSummaryInfo('skipped_products')->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->process($product);
 }
開發者ID:jacko972,項目名稱:pim-community-dev,代碼行數:14,代碼來源:AddProductValueProcessorSpec.php

示例13: ArrayCollection

 function it_reads_products($entityManager, $jobRepository, JobConfigurationRepositoryInterface $jobConfigurationRepo, JobInstance $jobInstance, JobExecution $jobExecution, JobConfigurationInterface $jobConfiguration, ProductQueryBuilderFactory $pqbFactory, ProductQueryBuilder $pqb, StepExecution $stepExecution, Cursor $cursor, ProductInterface $product, EntityRepository $customEntityRepository)
 {
     $jobRepository->getJobManager()->willReturn($entityManager);
     $stepExecution->getJobExecution()->willReturn($jobExecution);
     $customEntityRepository->findOneBy(['code' => 'update_product_value'])->willReturn($jobInstance);
     $jobInstance->getJobExecutions()->willReturn(new ArrayCollection([$jobExecution]));
     $jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution])->willReturn($jobConfiguration);
     $pqbFactory->create()->willReturn($pqb);
     $jobConfiguration->getConfiguration()->willReturn(json_encode(['filters' => [], 'actions' => []]));
     $pqb->execute()->willReturn($cursor);
     $cursor->next()->shouldBeCalled();
     $stepExecution->incrementSummaryInfo('read')->shouldBeCalledTimes(1);
     $this->setStepExecution($stepExecution);
     $cursor->current()->willReturn($product);
     $this->read()->shouldReturn($product);
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:16,代碼來源:FilteredProductReaderSpec.php

示例14: ConstraintViolation

 function it_adds_invalid_values_to_product($groupRepository, $validator, $templateUpdater, GroupInterface $variantGroup, ProductInterface $product, StepExecution $stepExecution, JobConfigurationRepositoryInterface $jobConfigurationRepo, JobExecution $jobExecution, JobConfigurationInterface $jobConfiguration, ProductTemplateInterface $productTemplate)
 {
     $violation = new ConstraintViolation('error2', 'spec', [], '', '', $product);
     $violations = new ConstraintViolationList([$violation, $violation]);
     $validator->validate($product)->willReturn($violations);
     $stepExecution->getJobExecution()->willReturn($jobExecution);
     $jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution])->willReturn($jobConfiguration);
     $jobConfiguration->getConfiguration()->willReturn(json_encode(['filters' => [], 'actions' => ['field' => 'variant_group', 'value' => 'variant_group_code']]));
     $groupRepository->findOneByIdentifier('variant_group_code')->willReturn($variantGroup);
     $product->getVariantGroup()->willReturn(null);
     $variantGroup->addProduct($product)->shouldBeCalled();
     $variantGroup->getProductTemplate()->willReturn($productTemplate);
     $templateUpdater->update($variantGroup->getProductTemplate(), [$product]);
     $stepExecution->addWarning(Argument::cetera())->shouldBeCalled();
     $stepExecution->incrementSummaryInfo('skipped_products')->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->process($product);
 }
開發者ID:vpetrovych,項目名稱:pim-community-dev,代碼行數:18,代碼來源:AddProductToVariantGroupProcessorSpec.php

示例15: ConstraintViolation

 function it_sets_invalid_values_to_attributes($validator, $propertySetter, FamilyInterface $family, AttributeInterface $attribute, AttributeRepository $attributeRepository, ProductInterface $product, ConstraintViolationListInterface $violations, StepExecution $stepExecution, JobConfigurationRepositoryInterface $jobConfigurationRepo, JobExecution $jobExecution, JobConfigurationInterface $jobConfiguration)
 {
     $stepExecution->getJobExecution()->willReturn($jobExecution);
     $jobConfigurationRepo->findOneBy(['jobExecution' => $jobExecution])->willReturn($jobConfiguration);
     $jobConfiguration->getConfiguration()->willReturn(json_encode(['filters' => [], 'actions' => [['field' => 'categories', 'value' => ['office', 'bedroom'], 'options' => []]]]));
     $validator->validate($product)->willReturn($violations);
     $violation = new ConstraintViolation('error2', 'spec', [], '', '', $product);
     $violations = new ConstraintViolationList([$violation, $violation]);
     $validator->validate($product)->willReturn($violations);
     $attributeRepository->findOneBy(['code' => 'categories'])->willReturn($attribute);
     $family->hasAttribute($attribute)->willReturn(true);
     $product->getFamily()->willReturn($family);
     $propertySetter->setData($product, 'categories', ['office', 'bedroom'], [])->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $stepExecution->addWarning(Argument::cetera())->shouldBeCalled();
     $stepExecution->incrementSummaryInfo('skipped_products')->shouldBeCalled();
     $this->process($product);
 }
開發者ID:jacko972,項目名稱:pim-community-dev,代碼行數:18,代碼來源:EditCommonAttributesProcessorSpec.php


注:本文中的Akeneo\Bundle\BatchBundle\Entity\StepExecution::getJobExecution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。