当前位置: 首页>>代码示例>>PHP>>正文


PHP Entity\StepExecution类代码示例

本文整理汇总了PHP中Akeneo\Bundle\BatchBundle\Entity\StepExecution的典型用法代码示例。如果您正苦于以下问题:PHP StepExecution类的具体用法?PHP StepExecution怎么用?PHP StepExecution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StepExecution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ArrayCollection

 function it_normalizes_a_step_execution(StepExecution $stepExecution, BatchStatus $status, \DateTime $startTime, $translator)
 {
     $stepExecution->getStepName()->willReturn('export');
     $translator->trans('export')->willReturn('Export step');
     $stepExecution->getSummary()->willReturn(['read' => 12, 'write' => 50]);
     $translator->trans('job_execution.summary.read')->willReturn('Read');
     $translator->trans('job_execution.summary.write')->willReturn('Write');
     $stepExecution->getStatus()->willReturn($status);
     $status->getValue()->willReturn(9);
     $translator->trans('pim_import_export.batch_status.9')->willReturn('PENDING');
     $stepExecution->getStartTime()->willReturn($startTime);
     $stepExecution->getEndTime()->willReturn(null);
     $startTime->getTimestamp()->willReturn(1411400461);
     $utcStartTime = new \DateTime();
     $utcStartTime->setTimestamp(1411400461);
     $finalDate = $utcStartTime->format('Y-m-d g:i:s A');
     $stepExecution->getWarnings()->willReturn(new ArrayCollection([new Warning($stepExecution->getWrappedObject(), 'a_warning', 'warning_reason', ['foo' => 'bar'], ['a' => 'A', 'b' => 'B', 'c' => 'C'])]));
     $translator->trans('a_warning')->willReturn('Reader');
     $translator->trans(12)->willReturn(12);
     $translator->trans(50)->willReturn(50);
     $translator->trans('warning_reason', ['foo' => 'bar'])->willReturn('WARNING!');
     $stepExecution->getFailureExceptions()->willReturn([['message' => 'a_failure', 'messageParameters' => ['foo' => 'bar']]]);
     $translator->trans('a_failure', ['foo' => 'bar'])->willReturn('FAIL!');
     $this->normalize($stepExecution, 'any')->shouldReturn(['label' => 'Export step', 'status' => 'PENDING', 'summary' => ['Read' => 12, 'Write' => 50], 'startedAt' => $finalDate, 'endedAt' => null, 'warnings' => [['label' => 'Reader', 'reason' => 'WARNING!', 'item' => ['a' => 'A', 'b' => 'B', 'c' => 'C']]], 'failures' => ['FAIL!']]);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:25,代码来源:StepExecutionNormalizerSpec.php

示例2:

 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

示例3: 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

示例4: updateStepExecution

 /**
  * {@inheritdoc}
  */
 public function updateStepExecution(StepExecution $stepExecution)
 {
     $jobExecution = $stepExecution->getJobExecution();
     if ($jobExecution) {
         $this->updateJobExecution($jobExecution);
     }
     parent::updateStepExecution($stepExecution);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:11,代码来源:DoctrineJobRepository.php

示例5:

 function it_reads_several_entities_from_a_yml_file_incrementing_summary_info(StepExecution $stepExecution)
 {
     $this->beConstructedWith(true, false);
     $stepExecution->incrementSummaryInfo('read_lines')->shouldBeCalled();
     $this->setFilePath(realpath(__DIR__ . '/../../../../../../features/Context/fixtures/fake_products_with_code.yml'));
     $this->setStepExecution($stepExecution);
     $this->read()->shouldReturn(['mug_akeneo' => ['sku' => 'mug_akeneo'], 't_shirt_akeneo_purple' => ['sku' => 't_shirt_akeneo_purple', 'color' => 'purple'], 'mouse_akeneo' => ['sku' => 'mouse_akeneo']]);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:8,代码来源:YamlReaderSpec.php

示例6:

 function it_increments_summary_info(StepExecution $stepExecution, ProductInterface $product1, ProductInterface $product2)
 {
     $product1->getId()->willReturn('45');
     $product2->getId()->willReturn(null);
     $stepExecution->incrementSummaryInfo('update')->shouldBeCalled();
     $stepExecution->incrementSummaryInfo('create')->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->write([$product1, $product2]);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:9,代码来源:ProductWriterSpec.php

示例7: getStepExecutionMessages

 /**
  * Returns the messages for a step execution
  *
  * @param StepExecution $stepExecution
  *
  * @return string
  */
 protected function getStepExecutionMessages(StepExecution $stepExecution)
 {
     $message = '';
     foreach ($stepExecution->getFailureExceptions() as $exception) {
         $message .= $this->getFailureExceptionMessage(sprintf('STEP %s', $stepExecution->getStepName()), $exception);
     }
     foreach ($stepExecution->getWarnings() as $warning) {
         $message .= $this->getWarningMessage($warning);
     }
     return $message;
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:18,代码来源:JobExecutionException.php

示例8: InvalidItemException

 function it_throws_an_exception_if_an_error_occurs_during_processing($transformer, $validator, $managerRegistry, ProductInterface $product, ColumnInfo $columnInfo, ObjectManager $objectManager, StepExecution $stepExecution)
 {
     $item = ['sku' => 'AKNTS', 'family' => 'tshirts', 'groups' => 'akeneo_tshirt', 'categories' => 'tshirts,goodies', 'SUBSTITUTION-groups' => '', 'SUBSTITUTION-products' => 'AKNTS_WPS,AKNTS_PBS,AKNTS_PWS', 'description-en_US-mobile' => '<p>Akeneo T-Shirt</p>', 'not_empty_attribute' => ''];
     $transformer->transform('Pim\\Component\\Catalog\\Model\\Product', $item, ['enabled' => true])->willReturn($product);
     $transformer->getErrors('Pim\\Component\\Catalog\\Model\\Product')->willReturn([]);
     $transformer->getTransformedColumnsInfo('Pim\\Component\\Catalog\\Model\\Product')->willReturn([$columnInfo]);
     $validator->validate($product, [$columnInfo], $item, [])->willReturn(['AKNTS' => [["The value \"\" for not empty attribute \"not_empty_attribute\" is empty"]]]);
     $managerRegistry->getManagerForClass(Argument::type('string'))->willReturn($objectManager);
     $stepExecution->incrementSummaryInfo('skip')->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->shouldThrow(new InvalidItemException('AKNTS: ', $item))->duringProcess($item);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:12,代码来源:ProductProcessorSpec.php

示例9: let

 function let(NotificationManager $manager, JobExecutionEvent $event, JobExecution $jobExecution, StepExecution $stepExecution, ArrayCollection $warnings, JobInstance $jobInstance, UserInterface $user, BatchStatus $status)
 {
     $this->beConstructedWith($manager);
     $jobExecution->getUser()->willReturn($user);
     $jobExecution->getStepExecutions()->willReturn([$stepExecution]);
     $jobExecution->getStatus()->willReturn($status);
     $jobExecution->getJobInstance()->willReturn($jobInstance);
     $stepExecution->getWarnings()->willReturn($warnings);
     $jobExecution->getId()->willReturn(5);
     $jobInstance->getType()->willReturn('export');
     $jobInstance->getLabel()->willReturn('Foo export');
     $event->getJobExecution()->willReturn($jobExecution);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:13,代码来源:JobExecutionNotifierSpec.php

示例10: 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

示例11: process

 public function process($item)
 {
     $sku = (string) $item['sku'];
     $attribute = $this->productManager->getIdentifierAttribute();
     $product = $this->productManager->findByIdentifier($sku);
     // if (!$product) {
     //     $product = $this->productManager->createProduct();
     //     $value   = $this->productManager->createProductValue();
     //     $value->setAttribute($attribute);
     //     $value->setData($sku);
     //     $product->addValue($value);
     //     $this->stepExecution->incrementSummaryInfo('create');
     //     return $product;
     // } else {
     if (!$product) {
         $data = current((array) $item);
         $this->stepExecution->incrementSummaryInfo('skip');
         throw new InvalidItemException(sprintf('Skip the existing %s product', $sku), $data);
     } else {
         $product_tab = array();
         $product_tab[] = $product;
         $this->productUpdater->setValue($product_tab, 'price', [['data' => (string) $item['price'], 'currency' => (string) $item['currency']]]);
         return $product;
     }
     // }
 }
开发者ID:Ragoupady,项目名称:akeneo-rag,代码行数:26,代码来源:ProductProcessor.php

示例12: write

 public function write(array $items)
 {
     foreach ($items as $product) {
         $this->productManager->save($product);
         $this->stepExecution->incrementSummaryInfo('save');
     }
 }
开发者ID:nidup,项目名称:pim-docs,代码行数:7,代码来源:ProductWriter.php

示例13: incrementCount

 /**
  * @param object $item
  */
 protected function incrementCount($item)
 {
     if ($item->getId()) {
         $this->stepExecution->incrementSummaryInfo('update');
     } else {
         $this->stepExecution->incrementSummaryInfo('create');
     }
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:11,代码来源:Writer.php

示例14: write

 public function write(array $items)
 {
     if (null === $this->file) {
         $this->file = new \SplFileObject($this->filePath, "w");
     }
     foreach ($items as $product) {
         $this->file->fputcsv($product);
         $this->stepExecution->incrementSummaryInfo('write');
     }
 }
开发者ID:Ragoupady,项目名称:akeneo-rag,代码行数:10,代码来源:ProductWriter.php

示例15: incrementCount

 /**
  * @param array $objects
  */
 protected function incrementCount(array $objects)
 {
     foreach ($objects as $object) {
         if ($object->getId()) {
             $this->stepExecution->incrementSummaryInfo('process');
         } else {
             $this->stepExecution->incrementSummaryInfo('create');
         }
     }
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:13,代码来源:BaseWriter.php


注:本文中的Akeneo\Bundle\BatchBundle\Entity\StepExecution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。