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


PHP AttributeInterface::getBackendType方法代码示例

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


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

示例1: setAttribute

 /**
  * Sets the attribute
  *
  * @param AttributeInterface $attribute
  *
  * @throws ColumnLabelException
  */
 public function setAttribute(AttributeInterface $attribute = null)
 {
     $this->attribute = $attribute;
     if (null === $attribute) {
         $this->locale = null;
         $this->scope = null;
         $this->suffixes = $this->rawSuffixes;
         $this->propertyPath = lcfirst(Inflector::classify($this->name));
     } else {
         if (!in_array($attribute->getBackendType(), [AbstractAttributeType::BACKEND_TYPE_REF_DATA_OPTION, AbstractAttributeType::BACKEND_TYPE_REF_DATA_OPTIONS])) {
             $this->propertyPath = $attribute->getBackendType();
         } else {
             $this->propertyPath = $attribute->getReferenceDataName();
         }
         $suffixes = $this->rawSuffixes;
         if ($attribute->isLocalizable()) {
             if (count($suffixes)) {
                 $this->locale = array_shift($suffixes);
             } else {
                 throw new ColumnLabelException('The column "%column%" must contain a locale code', ['%column%' => $this->label]);
             }
         }
         if ($attribute->isScopable()) {
             if (count($suffixes)) {
                 $this->scope = array_shift($suffixes);
             } else {
                 throw new ColumnLabelException('The column "%column%" must contain a scope code', ['%column%' => $this->label]);
             }
         }
         $this->suffixes = $suffixes;
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:39,代码来源:ColumnInfo.php

示例2:

 function it_throws_an_exception_when_the_locale_is_not_provided($qb, AttributeInterface $attribute)
 {
     $attribute->getCode()->willReturn('my_code');
     $attribute->getBackendType()->willReturn('options');
     $attribute->getAttributeType()->willReturn('pim_catalog_simpleselect');
     $this->shouldThrow('\\InvalidArgumentException')->duringAddAttributeSorter($attribute, 'desc', null, 'ecommerce');
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:7,代码来源:EntitySorterSpec.php

示例3:

 function it_returns_not_blank_and_datetime_constraints(AttributeInterface $attribute)
 {
     $attribute->isRequired()->willReturn(true);
     $attribute->getBackendType()->willReturn(AttributeTypes::BACKEND_TYPE_DATETIME);
     $constraints = $this->guessConstraints($attribute);
     $constraints->shouldHaveCount(2);
     $constraints->offsetGet(0)->shouldReturnAnInstanceOf('Symfony\\Component\\Validator\\Constraints\\NotBlank');
     $constraints->offsetGet(1)->shouldReturnAnInstanceOf('Symfony\\Component\\Validator\\Constraints\\DateTime');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:9,代码来源:AttributeConstraintGuesserSpec.php

示例4:

 function it_normalizes_value_with_decimal_support_backend(ProductValueInterface $value, AttributeInterface $attribute)
 {
     $attribute->getCode()->willReturn('code');
     $attribute->getBackendType()->willReturn('decimal');
     $attribute->isLocalizable()->willReturn(false);
     $attribute->isScopable()->willReturn(false);
     $value->getData()->willReturn('42.42');
     $value->getAttribute()->willReturn($attribute);
     $this->normalize($value, 'mongodb_json', [])->shouldReturn(['code' => 42.42]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:ProductValueNormalizerSpec.php

示例5: addFilter

 /**
  * @param AttributeInterface $attribute
  * @param array              $value
  * @param string             $operator
  * @param string             $locale
  * @param string             $scope
  */
 protected function addFilter(AttributeInterface $attribute, array $value, $operator, $locale = null, $scope = null)
 {
     $backendType = $attribute->getBackendType();
     $joinAlias = $this->getUniqueAlias('filter' . $attribute->getCode());
     // join to value
     $condition = $this->prepareAttributeJoinCondition($attribute, $joinAlias, $locale, $scope);
     $this->qb->innerJoin($this->qb->getRootAlias() . '.values', $joinAlias, 'WITH', $condition);
     $joinAliasPrice = $this->getUniqueAlias('filterP' . $attribute->getCode());
     $condition = $this->preparePriceCondition($value, $joinAliasPrice, $operator);
     $this->qb->innerJoin($joinAlias . '.' . $backendType, $joinAliasPrice, 'WITH', $condition);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:PriceFilter.php

示例6: addData

 /**
  * {@inheritdoc}
  */
 public function addData($data)
 {
     $backendType = $this->attribute->getBackendType();
     if ($this->attribute->isBackendTypeReferenceData()) {
         $backendType = $this->attribute->getReferenceDataName();
     }
     if (substr($backendType, -1, 1) === 's') {
         $backendType = substr($backendType, 0, strlen($backendType) - 1);
     }
     $name = 'add' . ucfirst($backendType);
     return $this->{$name}($data);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:AbstractProductValue.php

示例7: addFilter

 /**
  * Add filter to the query
  *
  * @param AttributeInterface $attribute
  * @param string             $operator
  * @param string             $value
  * @param string             $locale
  * @param string             $scope
  */
 protected function addFilter(AttributeInterface $attribute, $operator, $value, $locale = null, $scope = null)
 {
     $backendType = $attribute->getBackendType();
     $joinAlias = $this->getUniqueAlias('filter' . $attribute->getCode());
     // inner join to value
     $condition = $this->prepareAttributeJoinCondition($attribute, $joinAlias, $locale, $scope);
     $this->qb->innerJoin($this->qb->getRootAlias() . '.values', $joinAlias, 'WITH', $condition);
     $joinAliasOpt = $this->getUniqueAlias('filterM' . $attribute->getCode());
     $backendField = sprintf('%s.%s', $joinAliasOpt, 'baseData');
     $condition = $this->prepareCriteriaCondition($backendField, $operator, $value);
     $this->qb->innerJoin($joinAlias . '.' . $backendType, $joinAliasOpt, 'WITH', $condition);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:21,代码来源:MetricFilter.php

示例8: let

 function let(QueryBuilder $qb, AttributeValidatorHelper $attrValidatorHelper, Expr $expr, AttributeInterface $image)
 {
     $this->beConstructedWith($attrValidatorHelper, ['pim_catalog_image', 'pim_catalog_file'], ['STARTS WITH', 'ENDS WITH', 'CONTAINS', 'DOES NOT CONTAIN', '=', 'EMPTY', 'NOT EMPTY', '!=']);
     $this->setQueryBuilder($qb);
     $qb->getRootAlias()->willReturn('p');
     $qb->expr()->willReturn($expr);
     $image->getId()->willReturn(1);
     $image->getCode()->willReturn('picture');
     $image->isLocalizable()->willReturn(false);
     $image->isScopable()->willReturn(false);
     $image->getBackendType()->willReturn('media');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:12,代码来源:MediaFilterSpec.php

示例9:

 function it_normalizes_a_product_value_into_mongodb_document($mongoFactory, $serializer, ProductValueInterface $value, AttributeInterface $attribute, \MongoDBRef $mongoDBRef, \MongoId $mongoId)
 {
     $context = ['_id' => $mongoId, 'collection_name' => 'product'];
     $mongoFactory->createMongoId()->willReturn($mongoId);
     $mongoFactory->createMongoDBRef('product', $mongoId)->willReturn($mongoDBRef);
     $attribute->getId()->willReturn(123);
     $attribute->getBackendType()->willReturn('text');
     $value->getAttribute()->willReturn($attribute);
     $value->getData()->willReturn('my description');
     $value->getLocale()->willReturn(null);
     $value->getScope()->willReturn(null);
     $this->normalize($value, 'mongodb_document', $context)->shouldReturn(['_id' => $mongoId, 'attribute' => 123, 'entity' => $mongoDBRef, 'text' => 'my description']);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:13,代码来源:ProductValueNormalizerSpec.php

示例10:

 function it_sets_the_locale_and_scope_when_denormalizing_values($serializer, AttributeInterface $attribute)
 {
     $attribute->getAttributeType()->willReturn('pim_catalog_number');
     $attribute->getBackendType()->willReturn('decimal');
     $attribute->isBackendTypeReferenceData()->willReturn(false);
     $attribute->isLocalizable()->willReturn(true);
     $attribute->isScopable()->willReturn(true);
     $serializer->denormalize(1, 'pim_catalog_number', 'json', Argument::type('array'))->shouldBeCalled()->willReturn(1);
     $value = $this->denormalize(['data' => 1, 'locale' => 'en_US', 'scope' => 'ecommerce'], 'Pim\\Component\\Catalog\\Model\\ProductValue', 'json', ['attribute' => $attribute]);
     $value->shouldBeAnInstanceOf('Pim\\Component\\Catalog\\Model\\ProductValue');
     $value->getData()->shouldReturn(1);
     $value->getLocale()->shouldReturn('en_US');
     $value->getScope()->shouldReturn('ecommerce');
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:14,代码来源:ProductValueDenormalizerSpec.php

示例11:

 function it_adds_a_sorter_to_the_query($qb, AttributeInterface $metric)
 {
     $metric->getId()->willReturn(42);
     $metric->getCode()->willReturn('metric_code');
     $metric->getBackendType()->willReturn('metric');
     $metric->isLocalizable()->willReturn(false);
     $metric->isScopable()->willReturn(false);
     $condition = "sorterVmetric_code.attribute = 42";
     $qb->getRootAlias()->willReturn('r');
     $qb->leftJoin('r.values', 'sorterVmetric_code', 'WITH', $condition)->shouldBeCalled();
     $qb->leftJoin('sorterVmetric_code.metric', 'sorterMmetric_code')->shouldBeCalled();
     $qb->addOrderBy('sorterMmetric_code.baseData', 'DESC')->shouldBeCalled();
     $qb->addOrderBy('r.id')->shouldBeCalled();
     $this->addAttributeSorter($metric, 'DESC');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:MetricSorterSpec.php

示例12: addAttributeSorter

 /**
  * {@inheritdoc}
  */
 public function addAttributeSorter(AttributeInterface $attribute, $direction, $locale = null, $scope = null)
 {
     $aliasPrefix = 'sorter';
     $joinAlias = $aliasPrefix . 'V' . $attribute->getCode();
     $backendType = $attribute->getBackendType();
     // join to value
     $condition = $this->prepareAttributeJoinCondition($attribute, $joinAlias, $locale, $scope);
     $this->qb->leftJoin($this->qb->getRootAlias() . '.values', $joinAlias, 'WITH', $condition);
     $joinAliasMetric = $aliasPrefix . 'M' . $attribute->getCode();
     $this->qb->leftJoin($joinAlias . '.' . $backendType, $joinAliasMetric);
     $this->qb->addOrderBy($joinAliasMetric . '.baseData', $direction);
     $idField = $this->qb->getRootAlias() . '.id';
     $this->qb->addOrderBy($idField);
     return $this;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:MetricSorter.php

示例13: guessConstraints

 /**
  * {@inheritdoc}
  */
 public function guessConstraints(AttributeInterface $attribute)
 {
     $constraints = [];
     if ($attribute->isRequired()) {
         $constraints[] = new Constraints\NotBlank();
     }
     switch ($attribute->getBackendType()) {
         case AbstractAttributeType::BACKEND_TYPE_DATE:
             $constraints[] = new Constraints\Date();
             break;
         case AbstractAttributeType::BACKEND_TYPE_DATETIME:
             $constraints[] = new Constraints\DateTime();
             break;
     }
     return $constraints;
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:19,代码来源:AttributeConstraintGuesser.php

示例14:

 function it_adds_an_equal_filter_on_an_attribute_in_the_query($qb, $attrValidatorHelper, AttributeInterface $attribute, Expr $expr)
 {
     $attribute->getBackendType()->willReturn('backend_type');
     $attribute->getCode()->willReturn('code');
     $attribute->getId()->willReturn(42);
     $attribute->isLocalizable()->willReturn(false);
     $attribute->isScopable()->willReturn(false);
     $attrValidatorHelper->validateLocale($attribute, Argument::any())->shouldBeCalled();
     $attrValidatorHelper->validateScope($attribute, Argument::any())->shouldBeCalled();
     $qb->expr()->willReturn($expr);
     $qb->getRootAlias()->willReturn('p');
     $expr->eq(Argument::any(), true)->willReturn('filtercode.backend_type = true');
     $expr->literal(true)->willReturn(true);
     $qb->innerJoin('p.values', Argument::any(), 'WITH', Argument::any())->shouldBeCalled();
     $this->addAttributeFilter($attribute, '=', true);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:16,代码来源:BooleanFilterSpec.php

示例15: Expr

 function it_adds_an_attribute_sorter_to_the_query($qb, AttributeInterface $sku)
 {
     $sku->getId()->willReturn(42);
     $sku->getCode()->willReturn('sku');
     $sku->getBackendType()->willReturn('varchar');
     $sku->isLocalizable()->willReturn(false);
     $sku->isScopable()->willReturn(false);
     $qb->expr()->willReturn(new Expr());
     $qb->getRootAlias()->willReturn('p');
     $qb->getDQLPart('join')->willReturn([]);
     $qb->resetDQLPart('join')->shouldBeCalled();
     $condition = "sorterVsku.attribute = 42";
     $qb->leftJoin('p.values', 'sorterVsku', 'WITH', $condition)->shouldBeCalled();
     $qb->addOrderBy('sorterVsku.varchar', 'DESC')->shouldBeCalled();
     $qb->getRootAlias()->willReturn('p');
     $qb->addOrderBy("p.id")->shouldBeCalled();
     $this->addAttributeSorter($sku, 'DESC');
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:18,代码来源:BaseSorterSpec.php


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