Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sadikoff committed Dec 30, 2017
1 parent 0da15a0 commit aa803e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KoffI18nFormBundle
==================
koff/i18n-form-bundle
=====================

[![Build Status](https://travis-ci.org/sadikoff/i18n-form-bundle.svg?branch=master)](https://travis-ci.org/sadikoff/i18n-form-bundle)
[![Latest Stable Version](https://poser.pugx.org/koff/i18n-form-bundle/v/stable.svg?format=flat-square)](https://packagist.org/packages/koff/i18n-form-bundle)
Expand All @@ -17,8 +17,6 @@ Requirements
* i18n Doctrine strategy of your choice
* [KnpLabs/DoctrineBehaviors](https://github.com/KnpLabs/DoctrineBehaviors#translatable) with `knplabs/doctrine-behaviors`
* [Atlantic18/DoctrineExtensions](https://github.com/Atlantic18/DoctrineExtensions/blob/v2.4.x/doc/translatable.md) with `stof/doctrine-extensions-bundle`
* [A2lixI18nDoctrineBundle](https://github.com/a2lix/I18nDoctrineBundle) [Deprecated - will be removed from bundle in v.4.0.6]
* [PrezentDoctrineTranslatableBundle](https://github.com/Prezent/doctrine-translatable-bundle/blob/master/Resources/doc/index.md) [Deprecated - will be removed from bundle in v.4.0.6]

Installation
------------
Expand All @@ -40,8 +38,8 @@ Full configuration example
# config/packages/i18n_form.yaml
i18n_form:
locales: [en, fr, es, de]
default_locale: en
required_locales: [fr]
excluded_fields: ['id', 'locale', 'translatable']
```
Usage
Expand Down
20 changes: 7 additions & 13 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ private function localesSection(ArrayNodeDefinition $rootNode)
->arrayNode('locales')
->defaultValue(['en'])
->requiresAtLeastOneElement()
->prototype('scalar')
->beforeNormalization()
->ifString()->then($this->convertStringToArray)
->end()
->scalarPrototype()->end()
->beforeNormalization()->ifString()->then($this->convertStringToArray)->end()
->end()
;
}
Expand All @@ -60,10 +58,8 @@ private function requiredLocalesSection(ArrayNodeDefinition $rootNode)
$rootNode
->children()
->arrayNode('required_locales')
->prototype('scalar')
->beforeNormalization()
->ifString()->then($this->convertStringToArray)
->end()
->scalarPrototype()->end()
->beforeNormalization()->ifString()->then($this->convertStringToArray)->end()
->end()
;
}
Expand All @@ -75,12 +71,10 @@ private function excludedFieldsSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('locales')
->arrayNode('excluded_fields')
->defaultValue(['id', 'locale', 'translatable'])
->prototype('scalar')
->beforeNormalization()
->ifString()->then($this->convertStringToArray)
->end()
->scalarPrototype()->end()
->beforeNormalization()->ifString()->then($this->convertStringToArray)->end()
->end()
;
}
Expand Down

0 comments on commit aa803e3

Please sign in to comment.