-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPadam87MoneyBundle.php
More file actions
28 lines (22 loc) · 869 Bytes
/
Copy pathPadam87MoneyBundle.php
File metadata and controls
28 lines (22 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
namespace Padam87\MoneyBundle;
use Doctrine\DBAL\Types\Type;
use Padam87\MoneyBundle\Doctrine\Type\CurrencyType;
use Padam87\MoneyBundle\Doctrine\Type\DecimalObjectType;
use Padam87\MoneyBundle\Money\Context\BundleContext;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class Padam87MoneyBundle extends Bundle
{
public function boot(): void
{
$config = $this->container->getParameter('padam87_money.config');
BundleContext::setScale($config['scale']);
// @TODO: Keep an eye on https://github.com/doctrine/DoctrineBundle/issues/1867 for a better way to do this.
if (!Type::hasType('decimal_object')) {
Type::addType('decimal_object', new DecimalObjectType($config));
}
if (!Type::hasType('currency')) {
Type::addType('currency', CurrencyType::class);
}
}
}