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


PHP AttributeInterface::getDateMin方法代码示例

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


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

示例1:

 function it_adds_violation_when_date_min_is_not_valid($context, AttributeInterface $attribute, ValidDateRange $constraint)
 {
     $date = new \DateTime();
     $attribute->getDateMin()->willReturn('not_a_date');
     $attribute->getDateMax()->willReturn($date);
     $context->addViolationAt('dateMin', $constraint->invalidDateMessage)->shouldBeCalled();
     $this->validate($attribute, $constraint);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:8,代码来源:ValidDateRangeValidatorSpec.php

示例2: guessConstraints

 /**
  * {@inheritdoc}
  */
 public function guessConstraints(AttributeInterface $attribute)
 {
     $constraints = array();
     if ('pim_catalog_date' === $attribute->getAttributeType()) {
         $min = $attribute->getDateMin();
         $max = $attribute->getDateMax();
     } else {
         $min = $attribute->getNumberMin();
         $max = $attribute->getNumberMax();
         if (false === $attribute->isNegativeAllowed() && ($min === null || $min < 0)) {
             $min = 0;
         }
     }
     if (null !== $min || null !== $max) {
         $constraints[] = new Range(array('min' => $min, 'max' => $max));
     }
     return $constraints;
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:21,代码来源:RangeGuesser.php

示例3:

 function it_does_not_guess_minmax_date(AttributeInterface $attribute)
 {
     $attribute->getAttributeType()->willReturn('pim_catalog_date');
     $attribute->getDateMin()->willReturn(null);
     $attribute->getDateMax()->willReturn(null);
     $attribute->getNumberMin()->shouldNotBeCalled();
     $attribute->getNumberMax()->shouldNotBeCalled();
     $attribute->isNegativeAllowed()->shouldNotBeCalled();
     $constraints = $this->guessConstraints($attribute);
     $constraints->shouldReturn([]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:11,代码来源:RangeGuesserSpec.php

示例4: getVersionedData

 /**
  * Get extra data to store in version
  *
  * @param AttributeInterface $attribute
  *
  * @return array
  */
 protected function getVersionedData(AttributeInterface $attribute)
 {
     $dateMin = is_null($attribute->getDateMin()) ? '' : $attribute->getDateMin()->format(\DateTime::ISO8601);
     $dateMax = is_null($attribute->getDateMax()) ? '' : $attribute->getDateMax()->format(\DateTime::ISO8601);
     return ['available_locales' => $this->normalizeAvailableLocales($attribute), 'localizable' => $attribute->isLocalizable(), 'scope' => $attribute->isScopable() ? self::CHANNEL_SCOPE : self::GLOBAL_SCOPE, 'options' => $this->normalizeOptions($attribute), 'sort_order' => (int) $attribute->getSortOrder(), 'required' => (int) $attribute->isRequired(), 'max_characters' => (string) $attribute->getMaxCharacters(), 'validation_rule' => (string) $attribute->getValidationRule(), 'validation_regexp' => (string) $attribute->getValidationRegexp(), 'wysiwyg_enabled' => (string) $attribute->isWysiwygEnabled(), 'number_min' => (string) $attribute->getNumberMin(), 'number_max' => (string) $attribute->getNumberMax(), 'decimals_allowed' => (string) $attribute->isDecimalsAllowed(), 'negative_allowed' => (string) $attribute->isNegativeAllowed(), 'date_min' => $dateMin, 'date_max' => $dateMax, 'metric_family' => (string) $attribute->getMetricFamily(), 'default_metric_unit' => (string) $attribute->getDefaultMetricUnit(), 'max_file_size' => (string) $attribute->getMaxFileSize()];
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:13,代码来源:AttributeNormalizer.php


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