Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     switch (strtolower($value)) {
         case null:
             break;
         case 'male':
             //no break
         //no break
         case 'm':
             $value = true;
             break;
         case 'female':
             //no break
         //no break
         case 'f':
             $value = false;
             break;
         default:
             throw new InvalidValueException("Invalid gender value: {$value}");
     }
     return parent::convertToDatabaseValue($value, $platform);
 }
Ejemplo n.º 2
0
 public function convertToDatabaseValue($value, AbstractPlatform $platform = null)
 {
     $value = $value === 'false' ? 0 : ($value === 'true' ? 1 : $value);
     return parent::convertToDatabaseValue($value, $platform);
 }