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


PHP StepExecution::addWarning方法代码示例

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


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

示例1: addWarningMessage

 /**
  * @param ConstraintViolationListInterface $violations
  * @param ProductInterface                 $product
  */
 protected function addWarningMessage(ConstraintViolationListInterface $violations, ProductInterface $product)
 {
     foreach ($violations as $violation) {
         // TODO re-format the message, property path doesn't exist for class constraint
         // for instance cf VariantGroupAxis
         $invalidValue = $violation->getInvalidValue();
         if (is_object($invalidValue) && method_exists($invalidValue, '__toString')) {
             $invalidValue = (string) $invalidValue;
         } elseif (is_object($invalidValue)) {
             $invalidValue = get_class($invalidValue);
         }
         $errors = sprintf("%s: %s: %s\n", $violation->getPropertyPath(), $violation->getMessage(), $invalidValue);
         $this->stepExecution->addWarning($this->getName(), $errors, [], $product);
     }
 }
开发者ID:vpetrovych,项目名称:pim-community-dev,代码行数:19,代码来源:AbstractMassEditProcessor.php

示例2: incrementSkippedProductsCount

 /**
  * @param int   $nbSkippedProducts
  * @param array $skippedMessages
  */
 protected function incrementSkippedProductsCount($nbSkippedProducts, $skippedMessages)
 {
     $this->stepExecution->incrementSummaryInfo('skip_products', $nbSkippedProducts);
     foreach ($skippedMessages as $productIdentifier => $messages) {
         $this->stepExecution->addWarning($this->getName(), sprintf('Copy of values to product "%s" skipped.', $productIdentifier), [], $messages);
     }
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:11,代码来源:VariantGroupWriter.php

示例3: addWarning

 /**
  * Add a warning based on the stepExecution.
  *
  * @param string $message
  * @param array  $messageParameters
  * @param mixed  $item
  */
 protected function addWarning($message, array $messageParameters = [], $item = null)
 {
     $this->stepExecution->addWarning($this->getName(), $message, $messageParameters, $item);
     if (!is_array($item)) {
         $item = array();
     }
     $item = $this->cleanupImageContent($item);
     $event = new InvalidItemEvent(get_class($this), $message, $messageParameters, $item);
     $this->eventDispatcher->dispatch(EventInterface::INVALID_ITEM, $event);
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:17,代码来源:MagentoItemStep.php

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

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

示例6: filterDuplicateAxisCombinations

 /**
  * It checks it products is in eligible products for the variant group and
  * build the array based on variant axis and product ids.
  *
  * @param PaginatorInterface $paginator
  * @param array              $eligibleProductIds
  * @param array              $axisAttributeCodes
  *
  * @return array
  */
 protected function filterDuplicateAxisCombinations(PaginatorInterface $paginator, array $eligibleProductIds, array $axisAttributeCodes)
 {
     $productAttributeAxis = [];
     $acceptedIds = [];
     foreach ($paginator as $productsPage) {
         foreach ($productsPage as $product) {
             if (in_array($product->getId(), $eligibleProductIds)) {
                 $keyCombination = $this->generateAxisCombinationKey($product, $axisAttributeCodes);
                 $acceptedIds[] = $product->getId();
                 $productAttributeAxis = $this->fillDuplicateCombinationsArray($product, $productAttributeAxis, $keyCombination);
             } else {
                 $this->stepExecution->incrementSummaryInfo('skipped_products');
                 $this->stepExecution->addWarning('excluded', $this->translator->trans('pim_enrich.mass_edit_action.add-to-variant-group.already_in_variant_group_or_not_valid'), [], $product);
             }
         }
         $this->detachProducts($productsPage);
     }
     return [$productAttributeAxis, $acceptedIds];
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:29,代码来源:VariantGroupCleaner.php

示例7:

 function it_skips_and_adds_warning_if_there_are_categories_with_circular_references($transformer, $validator, CategoryInterface $childCategory, CategoryInterface $parentCategory, CategoryInterface $grandParentCategory, StepExecution $stepExecution)
 {
     $item1 = ['id' => 11, 'code' => 'child_category', 'parent' => 'parent_category', 'created' => 'date', 'root' => 1];
     $item2 = ['id' => 12, 'code' => 'parent_category', 'parent' => 'grand_parent_category', 'created' => 'date2', 'root' => 1];
     $item3 = ['id' => 13, 'code' => 'grand_parent_category', 'parent' => 'child_category', 'created' => 'date2', 'root' => 1];
     $data = [$item1, $item2, $item3];
     $transformer->transform('Pim\\Bundle\\CatalogBundle\\Entity\\Category', ['id' => 11, 'code' => 'child_category', 'created' => 'date', 'root' => 1])->willReturn($childCategory);
     $transformer->transform('Pim\\Bundle\\CatalogBundle\\Entity\\Category', ['id' => 12, 'code' => 'parent_category', 'created' => 'date2', 'root' => 1])->willReturn($parentCategory);
     $transformer->transform('Pim\\Bundle\\CatalogBundle\\Entity\\Category', ['id' => 13, 'code' => 'grand_parent_category', 'created' => 'date2', 'root' => 1])->willReturn($grandParentCategory);
     $transformer->getErrors('Pim\\Bundle\\CatalogBundle\\Entity\\Category')->willReturn([]);
     $transformer->getTransformedColumnsInfo('Pim\\Bundle\\CatalogBundle\\Entity\\Category')->willReturn([]);
     $validator->validate(Argument::cetera())->willReturn([]);
     $childCategory->setParent($parentCategory)->shouldBeCalled();
     $parentCategory->setParent($grandParentCategory)->shouldBeCalled();
     $grandParentCategory->setParent($childCategory)->shouldBeCalled();
     $childCategory->getCode()->willReturn('child_category');
     $childCategory->getParent()->willReturn($parentCategory);
     $parentCategory->getCode()->willReturn('parent_category');
     $parentCategory->getParent()->willReturn($grandParentCategory);
     $grandParentCategory->getCode()->willReturn('grand_parent_category');
     $grandParentCategory->getParent()->willReturn($childCategory);
     $stepExecution->incrementSummaryInfo('skip')->shouldBeCalledTimes(3);
     $stepExecution->addWarning('category_processor', 'parent: ', [], ['id' => 11, 'code' => 'child_category', 'created' => 'date', 'root' => 1])->shouldBeCalled();
     $stepExecution->addWarning('category_processor', 'parent: ', [], ['id' => 12, 'code' => 'parent_category', 'created' => 'date2', 'root' => 1])->shouldBeCalled();
     $stepExecution->addWarning('category_processor', 'parent: ', [], ['id' => 13, 'code' => 'grand_parent_category', 'created' => 'date2', 'root' => 1])->shouldBeCalled();
     $this->setStepExecution($stepExecution);
     $this->process($data)->shouldReturn([]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:28,代码来源:CategoryProcessorSpec.php

示例8: handleStepExecutionWarning

 /**
  * Handle step execution warning
  *
  * @param StepExecution                   $stepExecution
  * @param AbstractConfigurableStepElement $element
  * @param InvalidItemException            $e
  */
 protected function handleStepExecutionWarning(StepExecution $stepExecution, AbstractConfigurableStepElement $element, InvalidItemException $e)
 {
     if ($element instanceof AbstractConfigurableStepElement) {
         $warningName = $element->getName();
     } else {
         $warningName = get_class($element);
     }
     $stepExecution->addWarning($warningName, $e->getMessage(), $e->getMessageParameters(), $e->getItem());
     $this->dispatchInvalidItemEvent(get_class($element), $e->getMessage(), $e->getMessageParameters(), $e->getItem());
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:17,代码来源:ItemStep.php

示例9: addWarning

 /**
  * {@inheritDoc}
  */
 public function addWarning($name, $reason, array $reasonParameters, $item)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'addWarning', array($name, $reason, $reasonParameters, $item));
     return parent::addWarning($name, $reason, $reasonParameters, $item);
 }
开发者ID:aml-bendall,项目名称:ExpandAkeneoApi,代码行数:8,代码来源:__CG__AkeneoBundleBatchBundleEntityStepExecution.php

示例10: testAddWarning

 public function testAddWarning()
 {
     $getWarnings = function ($warnings) {
         return array_map(function ($warning) {
             return $warning->toArray();
         }, $warnings->toArray());
     };
     $this->stepExecution->addWarning('foo', '%something% is wrong on line 1', array('%something%' => 'Item1'), array('foo' => 'bar'));
     $this->stepExecution->addWarning('bar', '%something% is wrong on line 2', array('%something%' => 'Item2'), array('baz' => false));
     $item = new \stdClass();
     $this->stepExecution->addWarning('baz', '%something% is wrong with object 3', array('%something%' => 'Item3'), $item);
     $this->assertEquals(array(array('name' => 'my_step_execution.steps.foo.title', 'reason' => '%something% is wrong on line 1', 'reasonParameters' => array('%something%' => 'Item1'), 'item' => array('foo' => 'bar')), array('name' => 'my_step_execution.steps.bar.title', 'reason' => '%something% is wrong on line 2', 'reasonParameters' => array('%something%' => 'Item2'), 'item' => array('baz' => false)), array('name' => 'my_step_execution.steps.baz.title', 'reason' => '%something% is wrong with object 3', 'reasonParameters' => array('%something%' => 'Item3'), 'item' => array('id' => '[unknown]', 'class' => 'stdClass', 'string' => '[unknown]'))), $getWarnings($this->stepExecution->getWarnings()));
     $stepExecution = new StepExecution('my_step_execution.foobarbaz', $this->jobExecution);
     $stepExecution->addWarning('foo', '%something% is wrong on line 1', array('%something%' => 'Item1'), array('foo' => 'bar'));
     $stepExecution->addWarning('bar', '%something% is wrong on line 2', array('%something%' => 'Item2'), array('baz' => false));
     $this->assertEquals(array(array('name' => 'my_step_execution.steps.foo.title', 'reason' => '%something% is wrong on line 1', 'reasonParameters' => array('%something%' => 'Item1'), 'item' => array('foo' => 'bar')), array('name' => 'my_step_execution.steps.bar.title', 'reason' => 'something is wrong on line 2', 'reason' => '%something% is wrong on line 2', 'reasonParameters' => array('%something%' => 'Item2'), 'item' => array('baz' => false))), $getWarnings($stepExecution->getWarnings()));
 }
开发者ID:xleliberty,项目名称:BatchBundle,代码行数:17,代码来源:StepExecutionTest.php


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