diff --git a/generator/lib/behavior/i18n/I18nBehavior.php b/generator/lib/behavior/i18n/I18nBehavior.php index a749422ea..4a0167ef4 100644 --- a/generator/lib/behavior/i18n/I18nBehavior.php +++ b/generator/lib/behavior/i18n/I18nBehavior.php @@ -30,6 +30,7 @@ class I18nBehavior extends Behavior 'i18n_columns' => '', 'i18n_pk_name' => null, 'locale_column' => 'locale', + 'locale_length' => 5, 'default_locale' => null, 'locale_alias' => '', ); @@ -128,7 +129,7 @@ protected function addLocaleColumnToI18n() $this->i18nTable->addColumn(array( 'name' => $localeColumnName, 'type' => PropelTypes::VARCHAR, - 'size' => 5, + 'size' => $this->getParameter('locale_length') ? (int) $this->getParameter('locale_length') : 5, 'default' => $this->getDefaultLocale(), 'primaryKey' => 'true', )); diff --git a/test/testsuite/generator/behavior/i18n/I18nBehaviorTest.php b/test/testsuite/generator/behavior/i18n/I18nBehaviorTest.php index 9b85db041..47755e089 100644 --- a/test/testsuite/generator/behavior/i18n/I18nBehaviorTest.php +++ b/test/testsuite/generator/behavior/i18n/I18nBehaviorTest.php @@ -401,7 +401,37 @@ public function testModifyTableUseCustomPkName() $this->assertContains($expected, $builder->getSQL()); } + public function testModiFyTableUsesCustomI18nLocaleLength() + { + $schema = << + + + + + +
+ +EOF; + $builder = new PropelQuickBuilder(); + $builder->setSchema($schema); + $expected = <<assertContains($expected, $builder->getSQL()); + } + public function testTableWithPrefix() { $schema = <<