Skip to content

Commit e268698

Browse files
David Fuhrmerk
authored andcommitted
[DX] Improve configuration validation
The two nodes elastica_to_model_transformer.hydrate and elastica_to_model_transformer.ignore_missing must be boolean values but this was not validated in the configuration. This early validation provides better feedback to the developer who supplied an invalid configuration.
1 parent 181b026 commit e268698

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,11 @@ protected function getPersistenceNode()
538538
->arrayNode('elastica_to_model_transformer')
539539
->addDefaultsIfNotSet()
540540
->children()
541-
->scalarNode('hydrate')->defaultTrue()->end()
542-
->scalarNode('ignore_missing')->defaultFalse()->end()
541+
->booleanNode('hydrate')->defaultTrue()->end()
542+
->booleanNode('ignore_missing')
543+
->defaultFalse()
544+
->info('Silently ignore results returned from Elasticsearch without corresponding persistent object.')
545+
->end()
543546
->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()
544547
->scalarNode('service')->end()
545548
->end()

Resources/doc/usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ configuration options for this kind of searching, please see the [types](types.m
1111
documentation.
1212

1313
```php
14+
/* @var $finder \FOS\ElasticaBundle\Finder\TransformedFinder */
1415
$finder = $this->container->get('fos_elastica.finder.search.user');
1516

1617
// Option 1. Returns all users who have example.net in any of their mapped fields

0 commit comments

Comments
 (0)