当前位置: 首页>>代码示例>>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;未经允许,请勿转载。