/**
  * @param  mixed                                    $value
  * @param  AbstractPlatform                         $platform
  * @return \DateTime|DateTime
  * @throws \Doctrine\DBAL\Types\ConversionException
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (!($dateTime = parent::convertToPHPValue($value, $platform))) {
         return $value;
     }
     return new DateTime('@' . $dateTime->format('U'));
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return $value;
     }
     return Carbon::instance(parent::convertToPHPValue($value, $platform));
 }
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     $result = parent::convertToPHPValue($value, $platform);
     if ($result instanceof \DateTime) {
         return Date::instance($result);
     }
     return $result;
 }
 /**
  * Converts a value from its database representation to its PHP representation of this type
  *
  * @param mixed $value The value to convert
  * @param AbstractPlatform $platform The currently used database platform
  * @return mixed The PHP representation of the value
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     $dateTime = parent::convertToPHPValue($value, $platform);
     if (!$dateTime) {
         return $dateTime;
     }
     return new PrimaryDateTimeEntity('@' . $dateTime->format('U'));
 }
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     $value = parent::convertToPHPValue($value, $platform);
     return isset($value) ? \Carbon\Carbon::instance($value) : $value;
 }