May 28, 2018 Javier Eguiluz

Allow to set the rounding strategy for MoneyType ¶ Contributed by

syastrebov

in #26767. In Symfony 4.1, the MoneyType form field defines a new option called rounding_mode to control how the values are rounded. Before, all values were rounded towards "the nearest neighbor" ( ROUND_HALF_UP ) so 15.999 was rounded as 16.00 . Now you can set it for example to ROUND_DOWN to display it as 15.99 : 1 2 3 4 5 6 7 use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer ; use Symfony\Component\Form\Extension\Core\Type\MoneyType ; // ... $builder -> add ( 'price' , MoneyType :: class , array ( 'rounding_mode' => NumberToLocalizedStringTransformer :: ROUND_DOWN , ));

Adding and removing LDAP attributes more efficiently¶ Contributed by

Jean-Guilhem Rouel

in #21856. Updating LDAP entries with the update() is slow in some scenarios. That's why in Symfony 4.1 there are two new methods called addAttributeValues() and removeAttributeValues() that add/remove values to a multi-valued attribute: 1 2 3 4 5 6 7 8 9 use Symfony\Component\Ldap\Ldap ; use Symfony\Component\Ldap\Entry ; // ... $entry = $ldap -> query ( '...' , '...' ) -> execute ()[ 0 ]; $entityManager = $ldap -> getEntryManager (); $entityManager -> addAttributeValues ( $entry , 'telephoneNumber' , [ '+1.111.222.3333' , '+1.222.333.4444' ]); $entityManager -> removeAttributeValues ( $entry , 'telephoneNumber' , [ '+1.111.222.3333' , '+1.222.333.4444' ]);

Keep query string after redirecting¶ Contributed by

Hamza Amrouche

in #26281. In Symfony 4.1, routes can define (in YAML, XML or PHP) a new option called keepQueryParams . By default it's false , but if you set it to true , the query parameters (if any) are added to the redirected URL: 1 2 3 4 5 6 7 legacy_search : path : /search-engine controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction defaults : route : search permanent : true keepQueryParams : true In this example, if the original URL is /search-engine?q=symfony , the app redirects to /search?q=symfony