public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value !== null) { $value = utf8_encode($value); } return parent::convertToPHPValue($value, $platform); }
/** * * @param string $value * @param AbstractPlatform $platform * @return string */ public function convertToPHPValue($value, AbstractPlatform $platform) { try { $v = parent::convertToPHPValue($value, $platform); return BlockCipher::factory('mcrypt', array('algo' => 'aes'))->setKey(self::KEY)->decrypt($v); } catch (\Exception $ex) { return $value; } }
/** * @see \Doctrine\DBAL\Types\Type::convertToPHPValue() * @param string|null $sValue * @param \Doctrine\DBAL\Platforms\AbstractPlatform $oPlatform * @return string|null */ public function convertToPHPValue($sValue, \Doctrine\DBAL\Platforms\AbstractPlatform $oPlatform) { $sValue = parent::convertToPHPValue($sValue, $oPlatform); if (is_null($sValue)) { return $sValue; } if ($sFilterValue = filter_var($sValue, FILTER_VALIDATE_IP)) { return $sFilterValue; } throw \Doctrine\DBAL\Types\ConversionException::conversionFailedFormat($sValue, $this->getName(), 'valid IP adress'); }