/** * @see \Doctrine\DBAL\Types\JsonArrayType::convertToPHPValue() * @param string $sValue * @param \Doctrine\DBAL\Platforms\AbstractPlatform $oPlatform * @throws \Doctrine\DBAL\Types\ConversionException * @return \Zend\Http\Headers */ public function convertToPHPValue($sValue, \Doctrine\DBAL\Platforms\AbstractPlatform $oPlatform) { $aValue = parent::convertToPHPValue($sValue, $oPlatform); if (is_array($aValue)) { $oHeaders = new \Zend\Http\Headers(); return $oHeaders->addHeaders($aValue); } throw \Doctrine\DBAL\Types\ConversionException::conversionFailedFormat($sValue, $this->getName(), 'json encoded array'); }
/** * 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 array The PHP representation of the value. */ public function convertToPHPValue($value, AbstractPlatform $platform) { $this->initializeDependencies(); switch ($platform->getName()) { case 'postgresql': $value = is_resource($value) ? stream_get_contents($value) : $value; $array = parent::convertToPHPValue($value, $platform); break; default: $array = parent::convertToPHPValue($value, $platform); } if (is_array($array)) { $this->decodeObjectReferences($array); } return $array; }
/** * When database value is null, we return null instead of empty array like our parent does. * {@inheritdoc} */ public function convertToPHPValue($value, AbstractPlatform $platform) { return $value === null ? null : parent::convertToPHPValue($value, $platform); }
/** * {@inheritdoc} */ public function convertToPHPValue($value, AbstractPlatform $platform) { return is_array($value) ? $value : parent::convertToPHPValue($value, $platform); }
public function testRequiresSQLCommentHint() { $this->assertTrue($this->type->requiresSQLCommentHint($this->platform)); }