qbbr.io / blog

Tags: , ,
Source: markdown

1) create kernel event listener

2) modify onKernelRequest:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

namespace Acme\DemoBundle\EventListener;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;

class AcmeKernelListener
{
    protected $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function onKernelRequest(GetResponseEvent $event)
    {
        $this->container->get('twig')->getExtension('core')->setNumberFormat(2, '.', '');
    }
}

3) using number_format in twig

comments powered by Disqus
On your computer does not found Web Browser!
Plz install it.
Firefox
Chromium
Google Chrome
Safari
Opera