예제 #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;
     }
 }
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (!$value) {
         return '';
     }
     if (false === $value instanceof Source) {
         throw new \RuntimeException("Value should be a Source type.");
     }
     return parent::convertToDatabaseValue($value->getValue(), $platform);
 }
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (!$value) {
         return '';
     }
     if (false === $value instanceof Priority) {
         throw new \RuntimeException("Variable type validation failed, value should be a Priority type");
     }
     return parent::convertToDatabaseValue($value->getValue(), $platform);
 }
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (!$value) {
         return '';
     }
     if (false === $value instanceof User) {
         throw new \RuntimeException("Value should be a User type.");
     }
     return parent::convertToDatabaseValue((string) $value, $platform);
 }
 /**
  * @param File $value
  * @param AbstractPlatform $platform
  * @return string
  * @throws \RuntimeException
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (!$value) {
         return '';
     }
     if (false === $value instanceof File) {
         throw new \RuntimeException("Value should be a File type.");
     }
     /** @var $value File */
     return parent::convertToDatabaseValue($value->getPathname(), $platform);
 }
예제 #7
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');
 }
 public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
 {
     $declaration = parent::getSQLDeclaration($fieldDeclaration, $platform);
     switch ($platform->getName()) {
         case 'mysql':
             // The default MySQL collation is case-insensitive.
             break;
         case 'sqlite':
             $declaration .= ' COLLATE NOCASE';
             break;
         default:
             throw new \LogicException(sprintf('The platform "%s" is not supported by "string_case" type.', $platform->getName()));
     }
     return $declaration;
 }
 public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
 {
     return parent::convertToDatabaseValueSQL($sqlExpr, $platform);
 }
예제 #10
0
 /**
  * @inheritdoc
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     $table = $schema->getTable('oro_segment_snapshot');
     $table->changeColumn('entity_id', ['type' => StringType::getType('string')]);
 }
예제 #11
0
파일: FixedString.php 프로젝트: kingsj/core
 /**
  * Get SQL declaration
  *
  * @param array                                     $fieldDeclaration Field declaration
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform         Platform
  *
  * @return string
  */
 public function getSQLDeclaration(array $fieldDeclaration, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
 {
     $fieldDeclaration['fixed'] = true;
     return parent::getSQLDeclaration($fieldDeclaration, $platform);
 }