當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。