diff --git a/src/Extension/Type/FieldTypeExtension.php b/src/Extension/Type/FieldTypeExtension.php index dc2ada2..03c47e0 100644 --- a/src/Extension/Type/FieldTypeExtension.php +++ b/src/Extension/Type/FieldTypeExtension.php @@ -12,6 +12,7 @@ namespace Rollerworks\Component\Search\Extension\Doctrine\Dbal\Type; use Rollerworks\Component\Search\AbstractFieldTypeExtension; +use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -30,17 +31,30 @@ public function configureOptions(OptionsResolver $resolver) ['doctrine_dbal_conversion' => null] ); - $resolver->setAllowedTypes( - [ - 'doctrine_dbal_conversion' => [ + if ($resolver instanceof Options) { + $resolver->setAllowedTypes( + 'doctrine_dbal_conversion', + [ 'null', 'Closure', 'Rollerworks\Component\Search\Doctrine\Dbal\SqlFieldConversionInterface', 'Rollerworks\Component\Search\Doctrine\Dbal\SqlValueConversionInterface', 'Rollerworks\Component\Search\Doctrine\Dbal\ValueConversionInterface', - ], - ] - ); + ] + ); + } else { + $resolver->setAllowedTypes( + [ + 'doctrine_dbal_conversion' => [ + 'null', + 'Closure', + 'Rollerworks\Component\Search\Doctrine\Dbal\SqlFieldConversionInterface', + 'Rollerworks\Component\Search\Doctrine\Dbal\SqlValueConversionInterface', + 'Rollerworks\Component\Search\Doctrine\Dbal\ValueConversionInterface', + ], + ] + ); + } } /** diff --git a/src/Extension/Type/MoneyTypeExtension.php b/src/Extension/Type/MoneyTypeExtension.php index c4a64a8..f24f0e1 100644 --- a/src/Extension/Type/MoneyTypeExtension.php +++ b/src/Extension/Type/MoneyTypeExtension.php @@ -13,6 +13,7 @@ use Rollerworks\Component\Search\AbstractFieldTypeExtension; use Rollerworks\Component\Search\Extension\Doctrine\Dbal\Conversion\MoneyValueConversion; +use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -51,9 +52,13 @@ public function configureOptions(OptionsResolver $resolver) ] ); - $resolver->setAllowedTypes( - ['doctrine_dbal_with_currency' => ['bool']] - ); + if ($resolver instanceof Options) { + $resolver->setAllowedTypes('doctrine_dbal_with_currency', ['bool']); + } else { + $resolver->setAllowedTypes( + ['doctrine_dbal_with_currency' => ['bool']] + ); + } } /**