Пример #1
0
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value !== null) {
         $value = utf8_encode($value);
     }
     return parent::convertToPHPValue($value, $platform);
 }
Пример #2
0
 /**
  * 
  * @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;
     }
 }
Пример #3
0
 /**
  * @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');
 }