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


PHP ProductInterface::getCreated方法代码示例

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


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

示例1:

 function it_normalizes_an_existing_product_into_mongodb_document($mongoFactory, $serializer, ProductInterface $product, \MongoId $mongoId, \MongoDate $mongoDate, Association $assoc1, Association $assoc2, CategoryInterface $category1, CategoryInterface $category2, GroupInterface $group1, GroupInterface $group2, ProductValueInterface $value1, ProductValueInterface $value2, FamilyInterface $family)
 {
     $mongoFactory->createMongoId('product1')->willReturn($mongoId);
     $mongoFactory->createMongoDate()->willReturn($mongoDate);
     $family->getId()->willReturn(36);
     $category1->getId()->willReturn(12);
     $category2->getId()->willReturn(34);
     $group1->getId()->willReturn(56);
     $group2->getId()->willReturn(78);
     $product->getId()->willReturn('product1');
     $product->getCreated()->willReturn(null);
     $product->getFamily()->willReturn($family);
     $product->isEnabled()->willReturn(true);
     $product->getGroups()->willReturn([$group1, $group2]);
     $product->getCategories()->willReturn([$category1, $category2]);
     $product->getAssociations()->willReturn([$assoc1, $assoc2]);
     $product->getValues()->willReturn([$value1, $value2]);
     $context = ['_id' => $mongoId];
     $serializer->normalize($product, 'mongodb_json')->willReturn(['data' => 'data', 'completenesses' => 'completenesses']);
     $serializer->normalize($value1, 'mongodb_document', $context)->willReturn('my_value_1');
     $serializer->normalize($value2, 'mongodb_document', $context)->willReturn('my_value_2');
     $serializer->normalize($assoc1, 'mongodb_document', $context)->willReturn('my_assoc_1');
     $serializer->normalize($assoc2, 'mongodb_document', $context)->willReturn('my_assoc_2');
     $this->normalize($product, 'mongodb_document')->shouldReturn(['_id' => $mongoId, 'created' => $mongoDate, 'updated' => $mongoDate, 'family' => 36, 'enabled' => true, 'groupIds' => [56, 78], 'categoryIds' => [12, 34], 'associations' => ['my_assoc_1', 'my_assoc_2'], 'values' => ['my_value_1', 'my_value_2'], 'normalizedData' => ['data' => 'data'], 'completenesses' => []]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:25,代码来源:ProductNormalizerSpec.php

示例2: array

 function it_normalizes_product(SerializerInterface $serializer, ProductInterface $product, FamilyInterface $family, Completeness $completeness)
 {
     $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface');
     $this->setSerializer($serializer);
     $product->getFamily()->willReturn($family);
     $product->getGroups()->willReturn([]);
     $product->getValues()->willReturn([]);
     $product->getCompletenesses()->willReturn([$completeness]);
     $product->getCreated()->willReturn(null);
     $product->getUpdated()->willReturn(null);
     $product->isEnabled()->willReturn(true);
     $serializer->normalize($family, 'mongodb_json', [])->willReturn('family normalization');
     $serializer->normalize($completeness, 'mongodb_json', [])->willReturn(['completenessCode' => 'completeness normalization']);
     $this->normalize($product, 'mongodb_json', [])->shouldReturn([ProductNormalizer::FAMILY_FIELD => 'family normalization', ProductNormalizer::COMPLETENESSES_FIELD => array('completenessCode' => 'completeness normalization'), ProductNormalizer::ENABLED_FIELD => true]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:ProductNormalizerSpec.php

示例3: getDefaultDrupalProduct

 /**
  * @param  $product
  * @return array
  */
 public function getDefaultDrupalProduct(ProductInterface $product)
 {
     $labels = [];
     $attributeAsLabel = $product->getFamily()->getAttributeAsLabel();
     $availableLocales = $attributeAsLabel->getAvailableLocales();
     if (!is_null($availableLocales)) {
         foreach ($availableLocales as $availableLocale) {
             $labels[$availableLocale->getCode()] = $product->getLabel($availableLocale->getCode());
         }
     }
     // TODO: fix availableLocales doesn t must be NULL
     foreach ($attributeAsLabel->getTranslations() as $translation) {
         $labels[$translation->getLocale()] = $product->getLabel($translation->getLocale());
     }
     $defaultDrupalProduct = ['sku' => $product->getReference(), 'family' => $product->getFamily()->getCode(), 'created' => $product->getCreated()->format('c'), 'updated' => $product->getUpdated()->format('c'), 'status' => $product->isEnabled(), 'labels' => $labels, 'categories' => [], 'groups' => [], 'associations' => [], 'values' => []];
     return $defaultDrupalProduct;
 }
开发者ID:antoineguigan,项目名称:DrupalCommerceConnectorBundle,代码行数:21,代码来源:ProductNormalizer.php

示例4: getCustomValue

 /**
  * Get custom values (not provided by the PIM product)
  * @param ProductInterface  $product
  * @param MappingCollection $attributeCodeMapping
  * @param array             $parameters
  *
  * @return mixed
  */
 protected function getCustomValue(ProductInterface $product, MappingCollection $attributeCodeMapping, array $parameters = [])
 {
     return [strtolower($attributeCodeMapping->getTarget(self::VISIBILITY)) => $this->visibility, strtolower($attributeCodeMapping->getTarget(self::ENABLED)) => (string) $this->enabled ? 1 : 2, strtolower($attributeCodeMapping->getTarget('created_at')) => $product->getCreated()->format(AbstractNormalizer::DATE_FORMAT), strtolower($attributeCodeMapping->getTarget('updated_at')) => $product->getUpdated()->format(AbstractNormalizer::DATE_FORMAT), strtolower($attributeCodeMapping->getTarget('categories')) => $this->getProductCategories($product, $parameters['categoryMapping'], $parameters['scopeCode'])];
 }
开发者ID:jarocks,项目名称:MagentoConnectorBundle,代码行数:12,代码来源:ProductNormalizer.php


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