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


PHP AbstractPlatform::getDateFormatString方法代码示例

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


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

示例1: convertToPHPValue

 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     $val = \Psc\DateTime\Date::parse($platform->getDateFormatString(), $value);
     if (!$val) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
     }
     return $val;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:11,代码来源:DateType.php

示例2: convertToPHPValue

 /**
  * {@inheritdoc}
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null || $value instanceof \DateTime) {
         return $value;
     }
     $val = \DateTime::createFromFormat('!' . $platform->getDateFormatString(), $value);
     if (!$val) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
     }
     return $val;
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:14,代码来源:DateType.php

示例3: convertToPHPValue

 /**
  * @param \DateTimeImmutable|string|null $value
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @return \DateTimeImmutable|null
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null || $value instanceof DateTimeImmutable) {
         return $value;
     }
     $dateTime = DateTimeImmutable::createFromFormat('!' . $platform->getDateFormatString(), $value);
     if ($dateTime === false) {
         throw \Doctrine\DBAL\Types\ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
     }
     return $dateTime;
 }
开发者ID:researchsquare,项目名称:Doctrine-Date-Time-Immutable-Types,代码行数:16,代码来源:DateImmutableType.php

示例4: convertToPHPValue

 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     $val = \Improvein\MssqlBundle\Types\ImproveinDateTime::createFromFormat('!' . $platform->getDateFormatString(), $value);
     if (!$val) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
     }
     return $val;
 }
开发者ID:improvein,项目名称:MssqlBundle,代码行数:11,代码来源:DateType.php

示例5: convertToDatabaseValue

 /**
  * @param Date $value
  * @param AbstractPlatform $platform
  *
  * @return string
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if ($value instanceof Date) {
         return $value->toDateTime()->format($platform->getDateFormatString());
     }
     return parent::convertToDatabaseValue($value, $platform);
 }
开发者ID:zelenin,项目名称:value-object,代码行数:13,代码来源:DateType.php

示例6: convertToDatabaseValue

 /** @noinspection PhpMissingParentCallCommonInspection
  * @inheritdoc
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     /** @var string|null|DateTime $value */
     if ($value === null) {
         return null;
     }
     $dateTime = $value instanceof DateTime ? $value : DateTime::createFromFormat(static::JSON_API_FORMAT, $value);
     if ($dateTime === false) {
         throw ConversionException::conversionFailedFormat($value, $this->getName(), static::JSON_API_FORMAT);
     }
     return $dateTime->format($platform->getDateFormatString());
 }
开发者ID:limoncello-php,项目名称:json-api,代码行数:17,代码来源:DateJsonApiStringType.php

示例7: convertToPHPValue

 /**
  * @param                  $value
  * @param AbstractPlatform $platform
  *
  * @return \DateTime|mixed|null
  * @throws \Doctrine\DBAL\Types\ConversionException
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     if (is_null(self::$utc)) {
         self::$utc = new \DateTimeZone('UTC');
     }
     $val = \DateTime::createFromFormat($platform->getDateFormatString(), $value, self::$utc);
     if (!$val) {
         throw ConversionException::conversionFailed($value, $this->getName());
     }
     return $val;
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:21,代码来源:UTCDateType.php

示例8: convertToPHPValue

 /**
  * {@inheritdoc}
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     $val = \DateTime::createFromFormat('!' . $platform->getDateFormatString(), $value, self::$utc ? self::$utc : (self::$utc = new \DateTimeZone('UTC')));
     if (!$val) {
         throw ConversionException::conversionFailed($value, $this->getName());
     }
     $errors = $val->getLastErrors();
     // date was parsed to completely not valid value
     if ($errors['warning_count'] > 0 && (int) $val->format('Y') < 0) {
         return null;
     }
     return $val;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:19,代码来源:UTCDateType.php

示例9: convertToPHPValue

 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     return $value !== null ? \DateTime::createFromFormat('!' . $platform->getDateFormatString(), $value) : null;
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:4,代码来源:DateType.php

示例10: convertToPHPValue

 /**
  * @param  string|null $value
  * @param  AbstractPlatform $platform
  * @return DateTime|null
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     return $this->doConvertToPHPValue($value, $platform->getDateFormatString());
 }
开发者ID:DavidHavl,项目名称:Ajasta,代码行数:9,代码来源:UtcDateType.php


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