Skip to content

Commit

Permalink
bug #30 Fix Symfony 3 support (sstok)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

|Q            |A  |
|---          |---|
|Bug Fix?     |yes|
|New Feature? |no |
|BC Breaks?   |no |
|Deprecations?|no |
|Fixed Tickets|   |
|License      |MIT|

Commits
-------

63e2e9a Fix Symfony 3 support
  • Loading branch information
sstok committed Jan 1, 2016
2 parents 98ff4df + 63e2e9a commit bc03566
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
26 changes: 20 additions & 6 deletions src/Extension/Type/FieldTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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',
],
]
);
}
}

/**
Expand Down
11 changes: 8 additions & 3 deletions src/Extension/Type/MoneyTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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']]
);
}
}

/**
Expand Down

0 comments on commit bc03566

Please sign in to comment.