Browse files

Base the form currency value from the paramater list

  • Loading branch information...
1 parent 096da49 commit 838cab551e5dd513b90b2107eb6bfa440bc5e640 @mykehsd committed Feb 7, 2013
Showing with 11 additions and 1 deletion.
  1. +8 −1 Form/Type/MoneyType.php
  2. +3 −0 Resources/config/services.xml
View
9 Form/Type/MoneyType.php
@@ -16,6 +16,13 @@
class MoneyType extends BaseMoneyType
{
+ private $container = null;
+
+ public function setContainer($container)
+ {
+ $this->container = $container;
+ }
+
/**
* {@inheritdoc}
*/
@@ -25,7 +32,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'precision' => 2,
'grouping' => false,
'divisor' => 1,
- 'currency' => 'USD',
+ 'currency' => $this->container->getParameter('currency'),
'compound' => false,
));
}
View
3 Resources/config/services.xml
@@ -72,6 +72,9 @@
<service id="form.type.money" class="%sylius_settings.form.type.money%">
<tag name="form.type" alias="money" />
+ <call method="setContainer">
+ <argument type="service" id="service_container" />
+ </call>
</service>
</services>

0 comments on commit 838cab5

Please sign in to comment.