Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4777a4c5a0
48 lines (40 sloc) 1.004 kb
<?php
/*
* This file is part of the GenemuFormBundle package.
*
* (c) Olivier Chauvel <olivier@generation-multiple.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Genemu\Bundle\FormBundle\Form\JQuery\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* {@inheritdoc}
*
* @author Bilal Amarni <bilal.amarni@gmail.com>
*/
class ArrayToStringTransformer implements DataTransformerInterface
{
/**
* {@inheritdoc}
*/
public function transform($array)
{
if (null === $array || !is_array($array)) {
return '';
}
return implode(',', $array);
}
/**
* {@inheritdoc}
*/
public function reverseTransform($string)
{
if (is_array($string)) {
return $string;
}
return explode(',', $string);
}
}
Jump to Line
Something went wrong with that request. Please try again.