for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the FreshCommonApiBundle
*
* (c) Artem Henvald <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Fresh\CommonApiBundle\Form\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
/**
* BooleanDataTransformer.
* @author Artem Henvald <[email protected]>
class BooleanDataTransformer implements DataTransformerInterface
{
* {@inheritdoc}
public function transform($value)
return null;
}
public function reverseTransform($value)
if ('false' === $value || '0' === $value || '' === $value || 0 === $value) {
return false;
return true;